Push notifications error

40 views
Skip to first unread message

Thomas Huhn

unread,
Feb 27, 2012, 6:04:51 AM2/27/12
to cocoafi...@googlegroups.com
Push notifications work fine as long as I send them to a complete channel, in my case "GYA4F_DEMO". 

But as soon as I try to send a push notification to only one user, I get the following error:

{
  "meta": {
    "status": "fail",
    "code": 400,
    "message": "Illegal to_ids format",
    "method_name": "Notify"
  }
}

Here's the code that I'm testing:

curl -b cookies.txt -c cookies.txt -F "channel=GYA4F_DEMO" -F "to_ids=4f353699356f4e0bab000ccb" -F "payload=WHATEVER" http://api.cocoafish.com/v1/push_notification/notify.json?key=MY_APP_KEY

I've also tried to use the username or the device id instead of the cocoafish user id, but I always get the same result.

Any ideas what I'm doing wrong here?

Thanks,
Thomas

Thomas Huhn

unread,
Feb 27, 2012, 6:12:01 AM2/27/12
to cocoafi...@googlegroups.com
Figgered it out, seems to be a documentation bug: I remembered that the parameter had another name a couple of days ago: it's not "to_ids", but "user_ids[]".

Everything works fine with user_ids[] ...

Question: will the documentation be changed, or will the parameter name change?

Cheers,
Thomas

Wei Kong

unread,
Feb 27, 2012, 11:06:25 AM2/27/12
to cocoafi...@googlegroups.com
Hi,

We will fix the docs. Sorry about that.

Wei

-- 
Wei Kong
Sent with Sparrow

Wei Kong

unread,
Feb 27, 2012, 5:58:35 PM2/27/12
to cocoafi...@googlegroups.com
Hi Thomas,

Turned out the doc is correct but there was a bug that didn't handle one id in to_ids properly, it is fixed now. user_ids[] was not being processed that's why you didn't see any error. When there is no to_ids specified, it sends notification to all users who subscribed to the channel and that's why you were able to receive notification when you used user_ids[].

Thanks,
Wei

February 27, 2012 3:12 AM
Figgered it out, seems to be a documentation bug: I remembered that the parameter had another name a couple of days ago: it's not "to_ids", but "user_ids[]".

Everything works fine with user_ids[] ...

Question: will the documentation be changed, or will the parameter name change?

Cheers,
Thomas

On Monday, February 27, 2012 12:04:51 PM UTC+1, Thomas Huhn wrote:
February 27, 2012 3:04 AM

Thomas Huhn

unread,
Feb 28, 2012, 2:59:02 AM2/28/12
to cocoafi...@googlegroups.com
Hi Wei,

I was already starting to dig into the strange behaviour I saw, when I started testing with an additional iPad, not only the simulator and my iPhone. Happy to see this fixed now!

Thanks,
Thomas

Thomas Huhn

unread,
Mar 23, 2012, 6:41:53 AM3/23/12
to cocoafi...@googlegroups.com
Hi Wei,

sorry that I have to get back to this problem. After doing some thorough testing on different devices, I still face the strange behaviour that notifications are send to ALL devices subscribed to a channel, whatever you put into the "user_ids" parameter.

Examples:

I login as

curl -b cookies.txt -c cookies.txt -F "login=gya4f_34897676-c86d-4c5e-b465-6e270572a984" -F "password=PASSWORD" http://api.cocoafish.com/v1/users/login.json?key=KEY

and send to another user

curl -b cookies.txt -c cookies.txt -F "channel=com.solutionmedia.getyourapp4free" -F "user_ids=4f6c4931356f4e53dc002a44" -F "payload=test to admin" http://api.cocoafish.com/v1/push_notification/notify.json?key= KEY

but ALL users receive the message, even the one who was sending.

I've tried different parameters too:

user_ids   :    status ok, sends to all users
user_ids[] :    status ok, sends to all users
to_ids      :     status ok, but no notification received
to_ids[]     :    error "wrong parameter format"

Could you please have a look? I think to have this functionality running in a stable manor is really mission critical for many apps.

Thanks,
Thomas



On Monday, February 27, 2012 11:58:35 PM UTC+1, Wei Kong wrote:

Wei Kong

unread,
Mar 23, 2012, 2:42:17 PM3/23/12
to cocoafi...@googlegroups.com
Hi Thomas,

There is a doc error, it should be to_ids which takes a comma separated user id list.

Can you please give email us at in...@cocoafish.com with your app id that is having problem?

Wei

March 23, 2012 3:41 AM
Hi Wei,

sorry that I have to get back to this problem. After doing some thorough testing on different devices, I still face the strange behaviour that notifications are send to ALL devices subscribed to a channel, whatever you put into the "user_ids" parameter.

Examples:

I login as

curl -b cookies.txt -c cookies.txt -F "login=gya4f_34897676-c86d-4c5e-b465-6e270572a984" -F "password=PASSWORD" http://api.cocoafish.com/v1/users/login.json?key=KEY

and send to another user

curl -b cookies.txt -c cookies.txt -F "channel=com.solutionmedia.getyourapp4free" -F "user_ids=4f6c4931356f4e53dc002a44" -F "payload=test to admin" http://api.cocoafish.com/v1/push_notification/notify.json?key= KEY

but ALL users receive the message, even the one who was sending.

I've tried different parameters too:

user_ids   :    status ok, sends to all users
user_ids[] :    status ok, sends to all users
to_ids      :     status ok, but no notification received
to_ids[]     :    error "wrong parameter format"

Could you please have a look? I think to have this functionality running in a stable manor is really mission critical for many apps.

Thanks,
Thomas



On Monday, February 27, 2012 11:58:35 PM UTC+1, Wei Kong wrote:
February 27, 2012 2:58 PM
Reply all
Reply to author
Forward
0 new messages