To ensure network security, Push Kit disabled the TLS 1.0 and TLS 1.1 protocols and unsupported cipher suites for push-related domains on February 28, 2023. After the date, your app is unable to send push messages using the TLS protocol earlier than version 1.2 or unspecified cipher suites.
If your app uses TLS 1.0 or TLS 1.1 to access push-related domains, ensure that the protocol is updated to TLS 1.2 or later.
For details, please refer to Notice on Disabling the TLS 1.0 and TLS 1.1 Protocols for Push Kit Domains. If you have any questions, contact our technical support for help.
A maximum of 1000 tokens can be transferred each time when this API is called, and a maximum of 100 topic-based messages can be sent concurrently. Currently, this API only supports Android apps.
Protocol | HTTPS POST |
|---|---|
Direction | Your server -> Push Kit server |
URL | https://push-api.cloud.huawei.com/v1/[clientid]/topic:subscribe NOTE: In the URL, [clientid] indicates the OAuth 2.0 client ID (credential). To obtain the client ID, sign in to AppGallery Connect, click My projects, click the desired project, and go to the Project settings page. |
Data Format | Request: Content-Type: application/json Response: Content-Type: application/json |
Request Header
Parameter | Description | Example |
|---|---|---|
Authorization | For details, please refer to Client Credentials. NOTE: This parameter value is Bearer followed by a space character and then the value of access_token. | Bearer CF3Xl2XV6jMKZgqYSZFws9IPlgDvxqOfFSmrlmtkTRupbU2VklvhX9kC9JCnKVSDX2VrDgAPuzvNm3WccUIaDg== |
Request Body
Parameter | Mandatory (M)/Optional (O) | Type | Description |
|---|---|---|---|
topic | M | String | Name of a topic to be subscribed to. The value can contain a maximum of 900 characters, including digits, letters, underscores (_), percent signs (%), Chinese characters, dots (.), tildes (-), and dashes (-). |
tokenArray | M | Array [String] | Token list, which can contain a maximum of 1000 tokens. Example: ["pushtoken1","pushtoken2"] |
Response Body
Parameter | Type | Description |
|---|---|---|
code | String | Result code. |
msg | String | Result code description. |
requestId | String | Request ID. |
failureCount | Integer | Number of devices for which the topic fails to be subscribed to. |
successCount | Integer | Number of devices for which the topic is successfully subscribed to. |
errors | Array [Object] | Error list.
|
{
"msg": "partial token processed fail",
"code": "82000010",
"requestId": "1574*******00701",
"successCount": 1,
"failureCount": 1,
"errors": [
{
"index": 0,
"reason": "wrong token format"
}
]
} HTTP Status Code | Description | Solution |
|---|---|---|
200 | Success. | N/A |
400 | Incorrect parameter. | Rectify the fault based on the status code description. |
401 | Authentication failed. | Verify the access token in the Authorization parameter in the request HTTP header. |
404 | Service not found. | Verify that the request URI is correct. |
500 | Internal service error. | Go to , select the relevant category, and submit your ticket. Technical support personnel will get back to you as soon as possible. |
502 | The connection request is abnormal, generally because the network is unstable. | Try again later or contact technical support. |
503 | Traffic control. |
|
Service Result Code | Description | Solution |
|---|---|---|
80000000 | Success. | N/A |
80100001 | Incorrect parameter. | Verify the request parameters as prompted in the response. |
80100017 | A maximum of 100 topic-based messages can be sent at the same time. | Increase the interval for sending topic-based messages. |
80200001 | OAuth authentication error. | The access token in the Authorization parameter in the request HTTP header failed to be authenticated. Ensure that the access token is correct. |
80200003 | OAuth token expired. | The access token in the Authorization parameter in the request HTTP header expired. Obtain a new access token. |
80400005 | Not data processing location selected. | Set a correct data processing location for your app. For details, please refer to Managing the Default Data Processing Location. |
80400006 | The data processing location is inconsistent with the actual one. | Contact technical support. |
80400007 | You do not have permission to save user data. | Enable the precise messaging function for your project. |
82000007 | Invalid topic name. | Verify the topic parameter setting. |
82000008 | The tokenArray parameter is left empty or its value exceeded the threshold. | Verify the tokenArray parameter setting. |
82000009 | The number of topics exceeded the threshold (2000). | Verify the topic parameter setting. |
82000010 | Some tokens failed to be processed. | Check for these tokens. |
82000012 | The token is invalid. | Check for the token. |