Testing Service using cURL

cURL is a command-line tool for URL transfers available on most platforms, including Linux, Windows and Mac OS. You can use cURL to test your service credentials and send notifications to a MIDlet. The advantage of using cURL is that you can use it to test your MIDlet on both sandbox and production Service ID credentials.

These steps can be followed to test your service account and credentials using cURL command:

curl --digest -u "<service_id>:<service_secret>" https://alpha.one.ovi.com/nnapi/1.0/ping

where <service_id> and <service_secret> are the service credentials you received upon registration.

If the request is successful, you should see an HTTP result of 200. For any other response code, see the Notifications REST API protocol.

Send a notification using cURL

You can push a notification with the Notifications REST API using the following command:

curl --digest -u "<service_id>:<service_secret>" -d "payload=Test notification via Notifications API" https://alpha.one.ovi.com/nnapi/1.0/nid/<nid>

Where <service_id> and <service_secret> are the service credentials you received upon registration. The <nid> parameter should be NID: Notification ID; Notification ID received by your MIDlet must be URL encoded .

Note:

This command sends the "Test notification via Notifications API" text to the recipient.

Examples

Send notification using NID as follows:

curl --digest -u "example2.com:Wi23Rwu+PiON4/Yftc=" -d "payload=Test notification via Notifications API" https://alpha.one.ovi.com/nnapi/1.0/nid/kRCyZG6va5SrDJNe95ZYNPsHB0SKPlBefoYOMT2avhbRyPZ%3D

Send bulk notification using NID as follows:

curl --digest -u "example2.com:Wi23Rwu+PiON4/Yftc=" -d "payload=Test notification via Notifications API" -d "id=kRCyZG6va5SrDJNe95ZYNPsHB0SKPlBefoYOMT2avhbRyPZ%3D,1OISSX24tf12CSyltG45n7z8ZXggLXO14ULm7xTo5kuX98f%3D" https://alpha.one.ovi.com/nnapi/1.0/bulk/nid

Send notification using Publish as follows:

curl --digest -u "example2.com:Wi23Rwu+PiON4/Yftc=" -d "payload=Test notification via Notifications API" https://alpha.one.ovi.com/nnapi/1.0/publish

Last updated 9 October 2013

Back to top

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×