Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mirror api broken #315

Closed
nikmartin opened this issue Oct 25, 2014 · 7 comments
Closed

mirror api broken #315

nikmartin opened this issue Oct 25, 2014 · 7 comments
Assignees
Labels
🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@nikmartin
Copy link

mirror.timeline.insert calls createAPIRequest with the Subscription Resource which encodes POST as url query params, but they have to be sent as a json Request Body payload.
Re: https://github.com/google/google-api-nodejs-client/blob/master/lib/apirequest.js#L192
and
Re :https://developers.google.com/glass/v1/reference/subscriptions/insert

When using the client this way, the Mirror API returns:

{ errors: 
   [ { domain: 'global',
       reason: 'required',
       message: 'collection field is required for Subscription' },
     { domain: 'global',
       reason: 'required',
       message: 'callbackUrl field is required for Subscription' } ],
  code: 400,
  message: 'collection field is required for Subscription' }
@nikmartin nikmartin changed the title mirror api badly broken mirror api broken Oct 25, 2014
@ryanseys
Copy link
Contributor

You must always declare the resource under the resource key like this:

var req = mirror.subscriptions.insert({ 
  resource: { 
    callbackUrl: "http://example.com", 
    collection: "timeline" 
  } 
});
console.log(req.href); // https://www.googleapis.com/mirror/v1/subscriptions (look, no url params here)

This is different than the pre-1.0.x library, so I understand the confusion. Let me know if this helps you.

@ryanseys
Copy link
Contributor

You suggested mirror.timeline.insert but linked to mirror.subscriptions.insert however both should work. In the case of mirror.timeline.insert, this is a media upload so see the following docs on how to handle that: https://github.com/google/google-api-nodejs-client#media-uploads

@nikmartin
Copy link
Author

yes, sorry, we have a whole set of mirror apis we're trying to upgrade to 1.0 api

@ryanseys
Copy link
Contributor

Have you taken a look at the MIGRATING guide here that might help explain all the changes we made to make your migration as smooth as possible.

@nikmartin
Copy link
Author

yeah, I glazed right over:

drive.files.update({ fileId: 'abc', resource: resourceObj })

@ryanseys
Copy link
Contributor

😄

@ryanseys
Copy link
Contributor

Closing this under the impression that it's been resolved. Re-open if that's not the case @nikmartin

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants