cojohn / node-urban-airship

Simple wrapper for the Urban Airship API in Node.js.
MIT License
36 stars 15 forks source link

The new v3 API is not supported #9

Closed mbell8903 closed 10 years ago

mbell8903 commented 10 years ago

I am trying to use this module with v3 API and its not working as intended.

I have found two issues:

  1. You get a 'This app is not configured for iOS push'. To fix this i had to add "Accept": "application/vnd.urbanairship+json; version=3;" to the headers in UrbanAirship.prototype._transport
  2. The response codes for push have changed and include a 202 which is not in UrbanAirship.prototype._transport
cojohn commented 10 years ago

Thanks, I'll take a look at this. Issue #7 also addresses the v3 API and I'd asked for a pull request from the submitter, but it looks like it never happened.

mbell8903 commented 10 years ago

I'm happy to create a pull request for it, but i just made 2 minor tweaks for my needs and don't think it would be a fully featured fix. I can still do it if you'd like.

cojohn commented 10 years ago

My attention to UA's API changes has been lax. I need to update one of my current projects to interface with the v3 API, anyway, so I'm happy to take the information above and make my own changes. Of course, I always like pull requests.

I will likely bump major versions for v3 API support to avoid conflicts, anyway.

bohlander commented 10 years ago

Just a heads up -- if the library explicitly includes the v3 header, v2 style messages no longer work. Ie, if you are calling pushNotification() with a payload that includes APS, etc., those will fail when the v3 header is specified.

You need to use the updated format. http://docs.urbanairship.com/reference/api/v3/api-v3-migration-guide.html#api-push

Definitely surprising when you pull in the update from npm.

cojohn commented 10 years ago

@bohlander Aware, thank you. You should still be able to point to version 0.2.x in your package.json if you want to use the deprecated Urban Airship API.