×

Send binary notification using NID

Your service can send binary notification using Notification ID as follows:

The Nokia Notifications API also supports the PUT method for sending notifications. This method can be used for sending binary data as notification under the following conditions:

  • Payload must be part of HTTP request body as byte stream.

  • Payload content type can be defined within HTTP request headers. If it is not defined in the request, the Nokia Notifications API will set it to application/octet-stream.

  • Wakeup is always set to true by the Nokia Notifications API.

URL

/nnapi/1.0/nid/{NID}

NID: Notification ID; must be URL encoded

Note:

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

Method

PUT

Parameters

See REST API methods and parameters

Response

202 Accepted

The notification request was received and accepted to be directly delivered by the Notification server ( consumer is online).

204 No Content

Consumer is offline when notification request was received, application has been uninstalled or notifications are switched off by the user. In this case consumer is not able to receive this message.

Error cases

404 Bad Request

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

  • Content type too long.

  • Target Notification ID not specified. Add correct Notification ID to your request.

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

  • Notification ID incorrect. Check that you have correct Notification ID in request and that it's for correct site.

  • Notification ID is not for this site.

Response when Notification ID is not for this site but site is known:

<?xml version="1.0" encoding="UTF-8"?>
<notificationerror>
  <id desc="Recipient whose site is not current">{ID}</id> 
  <site desc="Address of site where id belongs to">{CORRECT SITE BASE URI}</site>
</notificationerror>

Response when Notification ID is not for this site and site is not known:

<?xml version="1.0" encoding="UTF-8"?>
<notificationerror>
  <id desc="Recipient whose site is not current">{ID}</id> 
</notificationerror>

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 PUT method

Request PUT URL

https://alpha.one.ovi.com/nnapi/1.0/nid/NIDexample1
curl --digest -u "<service_id>:<service_secret>" -X PUT --data-binary "@<absolute_filepath_to_binary_file>" https://alpha.one.ovi.com/nnapi/1.0/nid/NIDexample1

Response DATA

HTTP/1.1 202 Accepted
Content-Length:2
OK

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.

×