Ionic.io push notification with REST API

Hello,

I want push notification with ionic.io.
I’have tested push notification with platform https://apps.ionic.io/app. The notification work and good receive in android device.
But if i test push notification by REST API with request by PostMan:

POST: https://api.ionic.io/push/notifications
Content-Type application/json
Authorization Bearer {token}
{ "profile": "pushserver", "notification": { "title": "test", "message": "shit" } }
Result:
{ "data": { "status": "open", "created": "2016-08-23T08:29:31.699889+00:00", "app_id": "8c16d5af", "uuid": "f7cdd116-cdef-4e1e-9112-40af2e5597d7", "state": "enqueued", "config": { "notification": { "title": "test", "message": "shit" }, "profile": "pushserver", "user_ids": [ "ac7d1dcd-dd0e-4ee5-8f37-6892bc1d1edc" ] } }, "meta": { "status": 201, "request_id": "96f8552f-b368-43ac-86af-fd505992d4bc", "version": "2.0.0-beta.0" } }

But notification not work, don’t receive. And in plateform (https://apps.ionic.io/app) the list of Push Notifications don’t change.
If i test get information:
GET https://api.ionic.io/push/notifications/32581fc2-7795-4522-a742-6de6b1c249d5/messages
Content-Type application/json
Authorization Bearer {token}

RESULT:
{ "data": [], "meta": { "status": 200, "request_id": "bd221755-e0ea-4590-b618-cee3458f2bf0", "version": "2.0.0-beta.0" } }

data is empty !!! Why ?

Help me please. Thank you very much.
Sorry for my bad english.

Ok ! My notification work only if send a tokens in my request.
How send a notification all tokens ?

Include all tokens. IIRC you can’t mass send to all devices.

What ? @@
But platform ionic.io can send a notification to all devices ! I’have test, it’s work !
How to do with the API ? :’(

1 Like

I have to save the tokens of each device in a db ? For all included in request . That is not very practical. :confused:

Hi!
Can you show your code for migraton use?

have you found a solution to this issue ?

https://docs.ionic.io/api/endpoints/push.html#targeting-options
Last entry in the table is: send_to_all

1 Like

works like a charm :sweat_smile:

1 Like