Note: For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.
Push Device Registration (POST)
Creates a device registration with the push service.
Description
The device registrations happens from the device. The deviceId is the unique ID for the device for the application.
Method
POST
Path
/apps/applicationId/devices
Example
https://example.com:443/imfpush/v1/apps/myapp/devices
Path Parameters
- applicationId
- The name or identifier of the application
Header Parameters
Some header parameters are optional.
- Accept-Language
- (Optional) The preferred language to use for error messages. Default:en-US
- Authorization
- The token with the scope "devices.write" and "push.application.<applicationId>" obtained using the confidential client in the format Bearer token.. This parameter has to be mandatorily set.
- Content-Type
- Specify the JSON content type. For example: application/json. This parameter has to be mandatorily set.
Consumes
application/json
Produces
application/json
Payload
The details of the device registration.
JSON Example
{
"deviceId" : "12345-6789",
"phoneNumber" : "123456789",
"platform" : "A",
"token" : "xyz",
}
Payload Properties
The payload has the following properties:- deviceId
- Unique id of the device.
- phoneNumber
- Phone number to be used for SMS based notification.
- platform
- The device platform. 'A' refers to Apple(iOS) devices, 'G' refers to Google(Android) and 'W' refers to Microsoft(Windows) devices
- token
- Device token obtained via the service provider
Response
The details of the application.
JSON Example
{
"createdMode" : "API",
"createdTime" : "2015-05-20T11:42:11Z",
"deviceId" : "12345-6789",
"lastUpdatedTime" : "2015-05-20T11:42:11Z",
"phoneNumber" : "123456789",
"platform" : "A",
"token" : "xyz",
"userAgent" : "TestUserAgent",
"userId" : "admin",
}
Response Properties
The response has the following properties:
- createdMode
- The mode of creation.
- createdTime
- The date and time when the push device registration was created on the server in ISO 8601 format.
- deviceId
- Unique id of the device.
- lastUpdatedTime
- The date and time when the push device registration was last updated on the server in ISO 8601 format.
- phoneNumber
- Phone number to be used for SMS based notification.
- platform
- The device platform. 'A' refers to Apple(iOS) devices, 'G' refers to Google(Android) and 'W' refers to Microsoft(Windows) devices
- token
- Device token obtained via the service provider
- userAgent
- The user agent for the the device registration
- userId
- The user identifier for the the device registration
Errors
400Bad Request - The request was not understood by the push server. An invalid JSON could result in this error code.
401
Unauthorized - The caller is either not authenticated or not authorized to make this request.
405
Unsupported Content type - The content type specified in Content-Type header is not application/json.
406
Unsupported Accept type - The content type specified in Accept header is not application/json.
500
An internal error occurred.