cronofy / cronofy-node

Node wrapper for the Cronofy API
https://docs.cronofy.com/developers
MIT License
49 stars 23 forks source link

Updated 2.5.1 to 3.0.1, started getting problems with incorrect calender ID url encoding #47

Closed JaspervdK closed 6 years ago

JaspervdK commented 6 years ago

Hi, Recently we tried upgrading the cronofy package we use in our application to version 3.0.1, but this resulted in almost all google calender id's to be encoded incorrectly in the cronofy API requests. We reverted to version 2.5.1 to quickly fix this.
We tried debugging and it seemed that the query string transformation (here: https://github.com/cronofy/cronofy-node/blob/master/src/index.js#L39-L43) has some trouble, when a request is made with an array of id's.

A request like:

gshutler commented 6 years ago

Can you provide an example of the call you're make in JS. This wasn't an intended change and so we'll convert your example to a spec and fix it.

JaspervdK commented 6 years ago

Example request:

const cronofyOptions = {
  last_modified: new Date(request.payload.notification.changes_since).toISOString(),
  calendar_ids: ['acc_567236000909002'],
  include_deleted: 'true',
  tzid: 'Etc/UTC,
  access_token: -redacted-
};
return cronofyClient.readEvents(cronofyOptions, (err, response) => {
  // Here we get the following error back
  // Error: {"errors":{"calendar_ids":[{"key":"errors.invalid_calendar_ids","description":"One or 
  // more of the calendar IDs provided was invalid"}]}}
})

Thanks for taking a look

stephenbinns commented 6 years ago

This should be fixed in 3.0.2 thanks for the detailed report