google-api-nodejs-client
google-api-nodejs-client copied to clipboard
Keep api
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);
});
}