Each app can make a maximum of 60 API calls per minute. If this limit is exceeded, error code 83010002 will be returned.
This API is used only for pushing messages. Do not modify images that have passed the image risk check, as this may prevent notification messages from being displayed properly.
Protocol: HTTPS POST
Direction: Your server -> Huawei Push Kit server
URL: https://push-api.cloud.huawei.com/v1/[clientId]/images:verify
URL: https://push-api.cloud.huawei.com/v2/[projectId]/images:verify
Data format: Request: Content-Type: application/json
Response: Content-Type: application/json
[clientId]: OAuth 2.0 client ID (credential). To obtain the value, sign in to AppGallery Connect, click Development and services, click the desired project, and go to Project settings.
[projectId]: project ID. To obtain the value, sign in to AppGallery Connect, click Development and services, click the desired project, and go to Project settings.
The two URLs point to the same API, but only differ in the authentication mode. You can use either of them.
Request Header
| Parameter | Description | Example |
|---|---|---|
| Authorization | Authentication method: JWT: For details, please refer to Generating a JWT Based on a Service Account. NOTE You are advised to set the JWT validity period to 3600 seconds, within which a JWT can be reused. This parameter value is Bearer followed by a space character and then the obtained authentication information. | Bearer eyJraWQiOiIx---xxx.eyJhdWQiOiJodHR---xxx.QRodgXa2xeXSt4Gp---xxx |
| push-type | Message type. The options are as follows: 0: sends a notification containing a large icon 1: updates the image on a service widget 2: sends a text-to-speech message containing a large icon | 1 |
Request Body
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| imageUrl | Yes | String | Public URL of the image to be verified. It must use the HTTPS protocol. |
Response Body
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| code | Yes | String | Response code. |
| msg | Yes | String | Response code description. |
| requestId | No | String | Request ID. |
| downloadUrl | No | String | URL of the image that passes the risk check. (This parameter is returned only when the API call is successful.) This value is generated by the Huawei Push server by appending a risk control verification key to the original URL, ensuring that the image source is legitimate and tamper-proof. It can be used as the image URL for scenarios such as the large icon on the right side of a notification (corresponding to the image parameter of Notification) and service widget image (corresponding to the url parameter of FormImage). |
| expireTime | No | String | Expiration time of the image risk check, which is a Unix timestamp in seconds. (This parameter is returned only when the API call is successful.) |
Success response example:
{
"code": "83010000",
"msg": "Verify success",
"requestId": "1631***********0101",
"downloadUrl": "https://**.png?verifyKey=MEUCIQDzfYMReU*****************fdCOX9KToGq7o%3D",
"expireTime": "1689911616"
} Failure response example:
{
"code": "83010005",
"msg": "Download picture failed",
"requestId": "1691***********1501"
} | HTTP Response Code | Description | Solution |
|---|---|---|
| 200 | Success. | - |
| 400 | Parameter error. | Check the service response code and locate the fault based on it. |
| 401 | Authentication failure. | Verify the JWT in the Authorization parameter in the HTTP request header. |
| 404 | Service not found. | Check the request URL. |
| 500 | Internal service error. | Submit a ticket online. |
| 502 | Connection error. This typically occurs when network connectivity is unstable. | Try again later. If the fault persists, submit a ticket online. |
Message
Check Parameter Error.
Symptom
Parameter error.
Possible causes
Parameter error.
Solution
Check and modify request parameters as prompted by the response.
Message
only https allow.
Symptom
Invalid URL format.
Possible causes
Invalid URL format.
Solution
Verify that imageUrl uses the HTTPS protocol as prompted by the response.
Message
Authentication Error.
Symptom
Authentication error.
Possible causes
The request does not contain the Authorization parameter, or the Authorization parameter is left empty.
The project ID used for JWT application is different from that contained in the push request.
The JWT in the Authorization parameter does not match the app.
Solution
Rectify the authentication failure of the Authorization parameter in the request header as prompted by the response.
Verify that the request contains the Authorization parameter, and the Authorization parameter is not empty.
Verify that the value of projectId in the push request URL (https://push-api.cloud.huawei.com/v2/[projectId]/images:verify) is the same as the ID of the project to which your app belongs. For details, please refer to step 2 in Generating a JWT Based on a Service Account.
Verify that the JWT in the Authorization parameter matches the actual app. For details, please refer to Generating a JWT Based on a Service Account.
Generate a new JWT and then send the message.
Message
Access token expired.
Symptom
The access token has expired.
Possible causes
The access token has expired.
Solution
Generate a new JWT as prompted by the response and then send the request. For details, please refer to Generating a JWT Based on a Service Account.
Message
Jwt token expired.
Symptom
The JWT has expired.
Possible causes
The JWT has expired.
Solution
Generate a new JWT as prompted by the response and then send the request. For details, please refer to Generating a JWT Based on a Service Account.
Message
No permission to send message to these tmIDs.
Symptom
No permission.
Possible causes
Push Kit has not been enabled for the project.
Solution
Message
Verify success.
Symptom
The image passes the risk check.
Possible causes
The image passes the risk check.
Solution
None
Message
Verify failed.
Symptom
The image failed the risk check.
Possible causes
The image contains sensitive information.
Solution
Modify the image as prompted by the response and perform risk check on the image again.
Message
The number of sent messages exceeds the limit.
Symptom
The request frequency exceeds the traffic control threshold.
Possible causes
The request frequency exceeds the traffic control threshold (60 requests per minute per app).
Solution
Reduce the request frequency and try again.
Message
Request body is empty.
Symptom
The request body is empty.
Possible causes
The request body is empty.
Solution
Check and modify the request body as prompted by the response.
Message
Send control is not supported.
Symptom
Risk check is not supported.
Possible causes
No risk check policy is matched.
Solution
If no risk control policy is matched, submit a ticket online.
Message
Download picture failed.
Symptom
Failed to download the image.
Possible causes
The image URL in the request body is incorrect.
Solution
Verify the image URL in the request body as prompted by the response.
Message
The header does not contain valid push-type.
Symptom
Incorrect message type.
Possible causes
Incorrect message type.
Solution
Verify push-type as prompted by the response.