Problem Description:
We are unable to use the expire_after_seconds option when using the REST API
We are getting the following response
{
"meta": {
"code": 400,
"status": "fail",
"message": "Invalid json format on options parameter: can't convert ActiveSupport::HashWithIndifferentAccess into String"
}
}
\\
Testcase:
Uri
https://api.cloud.appcelerator.com/v1/push_notification/notify_tokens.json?key=
\\
Request headers
User-Agent: Fiddler
Host: api.cloud.appcelerator.com
Content-Length: 174
Cookie:
Content-Type: application/json
\\
Request body (POST)
{
"channel": "test",
"to_tokens": "everyone",
"payload": {
"alert": "Push Notification Test",
"title": "this is the title"
},
"options": {"expire_after_seconds": 86400}
}
Hi, I tested that API and check the source code. Are you sure you set options by the exactly same format {"expire_after_seconds": 86400}. because if you use single quotation marks like {'expire_after_seconds': 86400}, it will cause error then get the exception like you got. And there is something wrong with the documents. we have to use double quotation marks here.
Yes we are using double quotes We are still getting the same error as described above
Would please tell me do you use the notify_token API in a app, or a curl commands? And can you pass parts of the code you wrote, I have to make sure the data format.
We have tried using the notify_tokens API both from .NET 4.0 and Fiddler Here's a screenshot of how we compose the fiddler request: !https://www.dropbox.com/s/fz41rw3d4r7z625/fiddler.jpg! https://www.dropbox.com/s/fz41rw3d4r7z625/fiddler.jpg We are also having trouble showing the letters æøå on android devices, they are being shown as ? symbols UTF-8 encoding is being used from our .NET application
Hi, I am still testing notidy_tokens API's issue. Will notice you as soon as solve it. For the letter display problem, you may use ASCII code. Ref: http://www.ascii-code.com/
Thanks for the update We can't get the ASCII encoding to work with Å, Æ, Ø The iPhone accepts displays the ascii encoded characters correctly, but our android devices still shows ? symbols Your options fix seems to be working, so thanks for that :) Should I open a new issue about the encoding problem?
Ye, Please create a new issue about encoding problem, thanks.
Customer's options issue fixed.
The fix is no longer working. Everytime we try and apply the option expire_after_seconds, the API responds with a 500 Internal Server Error. You could guys Please fix the problem without having to apply a workaround.
Test with previous workaround applied:
Response:
Hi, First of all, the "expire_after_seconds" quotes issue has been fixed, and will be deployed to production in next release. By the time, you won't need work around any more. Then, I have tested your problem in last comment. I can't reproduce your problem. The code works well for me. So would you please try "curl" command again, if still not working, can you send me part of your code which I can find the problem. Ref my example:
Regards, Shuo