google-api-nodejs-client


Google Calendar API NodeJS - specify fields


Heyo, I'm using the google-api-nodejs-client package in my NodeJS project and I'm trying to build my query for calendar events. It's working, but I can't specify the "fields" field.
This returns five complete calendar events:
client.calendar.events.list({
calendarId: gcal_id,
maxResults: 5
})
.withAuthClient(authClient)
.execute(function(err, calendar) {
if (err)
console.log(err);
else
console.log(calendar);
});
But this returns nothing:
client.calendar.events.list({
calendarId: gcal_id,
maxResults: 5,
fields: {
items: ["end","start","status","summary"]
}
})
.withAuthClient(authClient)
.execute(function(err, calendar) {
if (err)
console.log(err);
else
console.log(calendar);
});
I've also tried:
fields: {
items: "end,start,status,summary"
}
Based on the Google Calendar V3 API, I should be able to make a query like this:
https://www.googleapis.com/calendar/v3/calendars/gcal_id.google.com/events?maxResults=5&fields=items(end%2Cstart%2Cstatus%2Csummary)&key={YOUR_API_KEY}
I'm not sure how to specify the "fields=items(end%2Cstart%2Cstatus%2Csummary)" portion of the URL, but I've tested it in Google's API Explorer and it works, so I know I'm doing something wrong in the JavaScript.
Any help would be much appreciated. For now I think I'll just clean up the response I get from the first code snippet.
Well, I figured it out. It should be one string.
fields: "items(end,start,status,summary)"

Related Links

Connecting to google v2 api sandbox using nodejs sdk google-api-nodejs-client
Difference between Javascript and Node.js version of Google Slides API
Accessing Google Api using Nodejs
google-api-nodejs-client: how to call google+ domain api locally? (by the plusDomains.media.insert)
Node.js Consuming a RESTful service application using MVC
Can't retrieve the play store reviews for my app
Prediction request end up with “invalid data” errors
google oauth2 implementation using Node JS error
Error 500 backendError with Gmail API and Google APIs Node Client
How can Dimensions be included in the API call object?
“npm install googleapis” produces the following error
Google Calendar API NodeJS - specify fields
How to make POST API calls with google-api-nodejs-client?
drive.comments.insert worked with previous version, not current

Categories

HOME
client
date
coq
keras
smarty
spagobi
spring-jdbc
amortized-analysis
sharepoint-designer
cakephp-2.5
sqlite3
v8
medical
kentor-authservices
commonmark
windows-phone-7
decomposition
http-status-code-504
code-review
karma-jasmine
visual-composer
amazonsellercentral
bootstrap-duallistbox
web-api-testing
ejabberd-module
objectanimator
fabric8
xquery-3.0
ioio
scorm2004
catel
fog
accelerate-framework
force-layout
retina-display
space-complexity
abstract-class
optix
core-plot
janrain
scorm
dotcover
xml-documentation
osx-mavericks
smartcontracts
termination
atomicity
errordocument
ionicons
git-diff
font-size
static-ip-address
rotativa
trash
markojs
dlna
xpath-1.0
tcpserver
citrus-pay
tableau-online
twirl
angular-local-storage
unity5.2.3
camanjs
knuth
google-style-guide
websocket4net
project-planning
aapt
fluentautomation
fmod
farseer
ms-project-server-2010
cdc
spring-io
blending
odata4j
seed
html-editor
clipper
tinn-r
dsn
semantic-diff
external-accessory
coredump
xmlspy
django-tagging
telerik-scheduler
remember-me
privilege
pascal-fc
gacutil
ugc
document-conversion

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App