Share via


Send a GCM Native Notification

 

Sends a GCM native notification through a notification hub.

Request

Method

Request URI

HTTP Version

POST

https://{namespace}.servicebus.windows.net/{NotificationHub}/messages/?api-version=2015-01

HTTP/1.1

Request Headers

The following table describes required and optional request headers.

Request Header

Description

Authorization

Token generated as specified in Shared Access Signature Authentication with Service Bus, or Service Bus authentication and authorization with Microsoft Azure Active Directory Access Control (also known as Access Control Service or ACS).

Content-Type

Set to application/json;charset=utf-8.

ServiceBusNotification-Tags

{single tag identifier} (optional)

ServiceBusNotification-Format

Set to gcm

Request Body

The request body is a JSON object as specified by GCM (without a registration_ids property). For example:

{ "collapse_key": "score_update",
  "time_to_live": 108,
  "delay_while_idle": true,
  "data": {
    "score": "4x8",
    "time": "15:16.2342"
  }
}

Response

The response includes an HTTP status code and a set of response headers.

Response Codes

Code

Description

200

Message successfully sent.

400

The request is malformed (for example, not valid routing headers, not valid content-type, message exceeds size, bad message format).

401

Authorization failure. The access key was incorrect.

403

Quota exceeded or message too large; message was rejected.

404

No message branch at the URI.

413

Requested entity too large. The message size cannot be over 64Kb.

For information about status codes, see Status and Error Codes.

Response Headers

Response Header

Description

Location

This header is only available for Standard tier Notification Hubs.

This header will contain the Notification Message ID. This is used with Per Message Telemetry: Get Notification Message Telemetry and correlating PNS Feedback. The location header uses the following format:

https://{your namespace}.servicebus.windows.net/{your hub name}/messages/{notification message id}?api-version=2015-04

Response Body

None.

See Also

Send an APNS Native Notification
Send an MPNS Native Notification
Send a WNS Native Notification
Send a Template Notification
Direct Send