Just a second...

Request and response JSON formats

A client sends push notification requests to the message path that the Push Notification Bridge listens on. The bridge responds through the same path. The default path is push/notifications. These requests and responses are in JSON format.

The following pieces of information are included in request messages:
destination_token
Push notification networks use binary tokens to represent an app installed on a device. This token combined with the transport prefix for the push notification network is the URI that the Push Notification Bridge uses to identify the device to send push notifications to.
topic_selector
The topic selector that the client subscribes to receive push notifications from or unsubscribes from receiving push notifications.
Note: This is not the same as the path that the request and response messages are sent through.

The results of including the contents of a subscription request with an unsubscription request are undefined.

Destination tokens

The destination token associated with the device and application to send a push notification to is provided to the application when the application registers with the push notification network.
Google Cloud Messaging

The destination token used by GCM is called registration token or instance ID. To get the instance ID for GCM, your client registers with the GCM connection servers using instanceId.getToken.

For more information, see the GCM documentation.

Apple Push Notification service

The destination token used by APNs is called device token. Use the registerForRemoteNotifications method on your UIApplication instance to get a device token.

For more information, see the APNs documentation.

When your app has successfully registered with the APNs, your UIApplicationDelegate instance is supplied with a device token through application:didRegisterForRemoteNotificationsWithDeviceToken.

Encode the device token in base 64 before you supply it to the Push Notification Bridge as an apns:// URI in a bridge subscription request:
-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    NSString * base64 = [deviceToken base64EncodedStringWithOptions:0];
    NSString * destination = [@"apns://" stringByAppendingString:base64];
    [self sendRequestWithDestination:destination];
}

Subscription request

The following message requests that updates to the topic at topic_selector be sent by APNs to the device identified by destination_token. The destination token is encoded in base64.

{  
	"pnsub":{  
		"destination":"apns://destination_token",
		"topic":"topic_selector"
	}
}

The following message requests that updates to the topic at topic_selector be sent by GCM to the device identified by destination_token.

{  
	"pnsub":{  
		"destination":"gcm://destination_token",
		"topic":"topic_selector"
	}
}

Unsubscription request

The following message requests that updates to the topic at topic_selector be no longer sent by APNs to the device identified by destination_token.

{  
	"pnunsub":{  
		"destination":"apns://destination_token",
		"topic":"topic_selector"
	}
}

The following message requests that updates to the topic at topic_selector be no longer sent by GCM to the device identified by destination_token.

{  
	"pnunsub":{  
		"destination":"gcm://destination_token",
		"topic":"topic_selector"
	}
}

Response

The following message is the response that the bridge sends to a requesting client if the request is successful.

{
    "response": {
        "content": result_json
    }
}

If the response message contains a content element, the request was successful.

Error response

The following message is the response that the bridge sends to a requesting client if an error occurs when processing the request.

{
    "response": {
        "error": "exception_text"
    }
}

If the response message contains an error element, the request was not successful. More information about the reason for the failure, is available in the exception_text