googleapis / googleapis/google-api-nodejs-client

Keep api

Open
#3,320 0 comments 0 reactions 0 assignees View on GitHub
priority: p3 type: question
Dominant language
TypeScript
Stars
12.2k
Forks
2k
Avg merge
1d 9h
Merged PRs (30d)
24

Description

this is what i’m trying (see code below), received 200 but no data in the body, if i well understood if i don’t send nothing as a get parameters the default json that i received back show the trash folder of keep notes - that was not empty.

there aren’t any example for nodejs except java and REST - I also tried calendar api with same token logic but it doesn’t work, in this last case i received 400 with localhost:80 error.

My goal is to fetch all keep notes as a list (as described in the documentation).

Thanks

const { google } = require("googleapis");

const axios = require('axios');

start()

async function start () {

const auth = new google.auth.GoogleAuth({
keyFile: "account_key.json",
scopes: [
"https://www.googleapis.com/auth/keep"
],
// 'online' (default) or 'offline' (gets refresh_token)
access_type: 'offline',
include_granted_scopes: true
});

const url = "https://keep.googleapis.com/v1/notes?pageSize=10"

const token = await auth.getAccessToken()

console.log(token)

axios.request({
url,
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Accept-Encoding': 'application/json',
Authorization: `Bearer ${token}`
},
})
.then(response => {
console.log(response.data)
})
.catch(err => {
console.log('err :', err);
});
}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.