tcbeaton
Posts: 0
Joined: Wed Oct 01, 2014 4:07 am

Assistance in setting Push Notification Channels for devices

I am attempting to set-up a REST API call to update the channel of a push notification device, but am having no luck. The online tutorial is pre-API Express and I gave API Express my best shot at figuring it out.

I have created an API Express service with the following settings:

1) Dragged "REST" component into chain and selected it.
2) Service URL is "https://api.appery.io/rest/push/reg/".
3) Service method is "PUSH".
4) Request Header Parameters include "Content-Type"='application/json' and "X-Appery-Id"=undefined.
5) I have tried putting "channels" in both the Request Query Parameters and Request Header Parameters sections.

When I test the update using the CURL (see bottom of this message) with the same items defined, as per the documentation, all works fine. When I click "GENERATE" and enter the information for the X-Appery-Id and channels, the HTTP_RESPONSE_CODE is 200, but the channel information is not updated ("xxx" added to deviceID and App-Id for security):
[quote:]
{
"BODY": {
"id": "57d20173e4b071c20d9ade79",
"token": "faCAahi17WQ:APA91bHdKERtAK6MVQbW7qdeZc3uaIMKK687YO2WymBYSvJ4n8SF6lIcbpmoZAaKHQ1RuopqHj8UMs20e1UgptXEgQ2OYP5ptEiYebUr7L_WO56d3YEJOWI8ZyC7Isv1maUzkXrMDOtL",
"deviceID": "b10693f5cdfd3xxx",
"timeZone": "GMT-04:00",
"type": "A",
"createdAt": "2016-09-09 00:25:23.518",
"_updatedAt": "2016-09-09 02:14:18.735",
"channels": [
"H"
]
},
"HTTP_RESPONSE_HEADERS": {
"Strict-Transport-Security": "max-age=15768000",
"Transfer-Encoding": "chunked",
"Date": "Fri, 09 Sep 2016 02:14:18 GMT",
"channels": "[4]",
"X-Appery-App-Id": "38bc4817-4381-4cf1-a296-90330f6ecxxx",
"Content-Type": "application/json",
"Connection": "keep-alive",
"Server": "nginx"
},
"HTTP_RESPONSE_CODE": 200
}
[/quote]

The following CURL command from an external server works correctly:
[quote:]
curl -X PUT -H "Content-Type: application/json" -H "X-Appery-App-Id: 38bc4817-4381-4cf1-a296-90330f6ecxxx" -d '{"channels":[4]}' https://api.appery.io/rest/push/reg/b...
[/quote]

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Assistance in setting Push Notification Channels for devices

Hello,

Please look at this link, how to use device update service

1) Service URL has to have deviceId
2) Please use a method "PUT" instead of "PUSH"
3) Please use a request parameter "X-Appery-App-Id" instead of "X-Appery-Id" and set it's read value instead of "undefined"

tcbeaton
Posts: 0
Joined: Wed Oct 01, 2014 4:07 am

Assistance in setting Push Notification Channels for devices

Sergiy, The word "PUSH" was a typo... it really was "PUT" (I'm very frustrated in how complicated this process is).

I've got another topic set-up for this, to which you've also been responding; to save time, we can consider this post closed to save our time ( https://getsatisfaction.com/apperyio/... ).

Return to “Issues”