Querying the Endpoints of an Application

Function

This API is used to query the endpoints of an application.

URI

GET /v2/{project_id}/notifications/applications/{application_urn}/endpoints

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

See Obtaining a Project ID.

application_urn

Yes

String

Specifies the unique resource identifier of the application. You can obtain it based on Querying Platform Applications.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Specifies the offset.

If the value is an integer greater than 0 but less than the number of resources, all resources after this offset will be queried. The default value is 0.

Default value: 0

limit

No

Integer

Specifies the maximum number of records in each query.

The value ranges from 1 to 100 and is generally 10, 20, or 50, indicating the number of resources returned on each page. The default value is 100.

Default value: 100

enabled

No

String

Specifies whether a device is enabled. The value can be true or false.

token

No

String

Specifies the device token, which contains a maximum of 512 bytes.

user_data

No

String

Description or additional information about the endpoint. The value cannot exceed 2048 bytes.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token.

It can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the request ID, which is unique.

next_page_flag

Boolean

Specifies whether a link to the next page is provided.

endpoints

Array of ApplicationEndpoint objects

Specifies the application_endpoint structure array.

Table 5 ApplicationEndpoint

Parameter

Type

Description

create_time

String

Specifies the time when the application was created. The UTC time is in YYYY-MM-DDTHH:MM:SSZ format.

endpoint_urn

String

Specifies the unique resource identifier of the application endpoint.

user_data

String

Specifies the user-defined data. The value is a UTF-8 encoded string not exceeding 2048 bytes.

enabled

String

Whether an endpoint is enabled for notifications The value can be true or false.

token

String

Specifies the device token. The value cannot exceed 512 bytes.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the request ID, which is unique.

code

String

Specifies the error code.

message

String

Describes the error message.

Status code: 403

Table 7 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the request ID, which is unique.

code

String

Specifies the error code.

message

String

Describes the error message.

Status code: 404

Table 8 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the request ID, which is unique.

code

String

Specifies the error code.

message

String

Describes the error message.

Status code: 500

Table 9 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the request ID, which is unique.

code

String

Specifies the error code.

message

String

Describes the error message.

Example Requests

GET https://{SMN_Endpoint}/v2/{project_id}/notifications/applications/{application_urn}/endpoints?offset=0&limit=10

null

Example Responses

Status code: 200

OK

{
  "request_id" : "c90d871f77f7425cae0a8b772a563d17",
  "next_page_flag" : false,
  "endpoints" : [ {
    "create_time" : "2018-01-12T01:25:14Z",
    "endpoint_urn" : "urn:smn:regionId:429ffced18074da0938112f2c362b935:endpoint-APNS-application_name-62f0bafec61c45fbbb5d0fc6bd696a2d",
    "user_data" : "no user data",
    "enabled" : "true",
    "token" : "1f2fda4c1013c47ac4c59bd22379d88e14b07b0ebf47f2f79d1a6b06ed03390d"
  } ]
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

403

Unauthorized

404

Not Found

500

Internal Server Error

Error Codes

See Error Codes.