We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All

Deleting a Topic

NOTICE

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.

Function

This API is used to delete a topic and all subscription relationships (associations between the topic and tokens) of the topic.

Restrictions

This API can be called for a maximum of 100 times each day.

Prototype

Protocol

HTTPS POST

Direction

Your server -> Push Kit server

URL

https://push-api.cloud.huawei.com/v1/[clientid]/topic:truncate

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 Parameters

Request Header

Expand

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

Expand

Parameter

Mandatory (M)/Optional (O)

Type

Description

topic

M

String

Name of a topic. The value can contain a maximum of 900 characters, including only digits, letters, underscores (_), periods (.), tildes (~), percent signs (%), and Chinese characters.

Request Example

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "topic": "weather"
  3. }

Response Parameters

Response Body

Expand

Parameter

Type

Description

code

String

Result code.

msg

String

Result code description.

requestId

String

Request ID.

Response Example

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "msg": "success",
  3. "code": "80000000",
  4. "requestId": "157*******000701"
  5. }

Result Codes

Expand

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 Support > Customer Service > Submit ticket online, 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.

Expand

Service Result Code

Description

Solution

80000000

Success.

N/A

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 has 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 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.

82000014

API calls exceeded the maximum.

This API can be called for a maximum of 100 times each day.