Send Notification using Publish

Your service can send notification using Publish as follows:

Use this method to publish a notification to all registered client applications online. This is the easiest method for sending a notification to all online client applications by using just one Notifications REST API request.

URL

/nnapi/1.0/publish

Note:

This is a cURL command. For more information, see Testing Service using cURL.

Method

POST

Parameters

See REST API methods and parameters

Response

200 OK

The notification request was received and accepted by the server; this does not guarantee that the notification will be delivered to the client application.

Error cases

400 Bad Request

Read the response body to check the error cause. It can be one of the following:

  • Maximum length exceeded for enc, ctype, title, subtitle, type or icon.

  • Unknown version. Only version 1.0 is currently supported. Any other version (or no version) returns 400 Bad Request.

  • Application ID and/or Service ID incorrect.

  • Mandatory toapp parameter missing.

  • Target Application ID not specified. Add correct application ID to your request.

  • Request contains illegal characters. Only characters allowed by XML 1.0 specification are supported.

401 Unauthorized

  • Authorisation failed. Incorrect service credentials.

  • Application ID incorrect. Check that you have correct Application ID in request.

  • TCP/TLS connection for the HTTP requests may not be persistent. Make sure that your service uses a persistent TCP/TLS connection for the HTTP requests.

  • Forbidden service. Service access to Nokia Notifications API is forbidden.

408 Request Timeout

There was no indication that the message has been delivered to the server. This does not cover situations when the message cannot be delivered to the actual mobile device, for example, because of fade out from the wireless network coverage.

413 Request Entity Too Large

Payload exceeded maximum size 1.5 kB i.e. 1536 bytes.

500 Internal Server Error

Server encountered an unrecoverable error.

503 Service unavailable

Maximum number of notifications that can be sent over an hour was exceeded.

Example

Sending notification using publish

Request POST URL

https://alpha.one.ovi.com/nnapi/1.0/publish

Request POST DATA

payload=Test+publish+notification
curl --digest -u "<service_id>:<service_secret>" –d "toapp= <application_id>” -d "payload=Test publish notification" https://alpha.one.ovi.com/nnapi/1.0/publish

Response DATA

HTTP/1.1 200 OK
Content-Length:2
OK