目录

Request Body Structure

API Prototype

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

Request Header

Parameter Description Example
Authorization

Authentication mode: JWT

Note:

HarmonyOS 5 and later versions no longer support OAuth 2.0-based authentication.

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 eyJr*****OiIx---****.eyJh*****iJodHR--***.QRod*****4Gp---****
push-type

Message type. The options are as follows:

0: alert message (notification message and badge message)

1: widget update message

2: text-to-speech message

6: background message

7: live view message

10: in-app call message

0

Request Body

Parameter Mandatory Type Description
payload Yes Object

Push message struct. Different push-type scenarios have different payload definitions.

0: AlertPayload (notification message)

0: BadgePayload (badge app icon update message)

1: FormUpdatePayload (widget update message)

2: ExtensionPayload (text-to-speech message)

6: BackgroundPayload (background message)

7: LiveViewPayload (live view message)

10: VoIPCallPayload (in-app call message)

pushOptions No Object Sending control parameter. For details, please refer to pushOptions.
target Yes Object Sending target. For details, please refer to target.
Request Header
├── Content-Type: application/json
├── Authorization: API authentication token
└── push-type: Scenario-specific message type

Request Body
├── pushOptions
│    ├── testMessage: Indicates whether a message is a test message
│    └── Other parameters...
├── payload
│    # Type 1: Notification message. For details, please refer to AlertPayload.
│    └── notification
│         ├── category: Message type
│         ├── title: Notification title
│         ├── body: Notification body
│         └── Other parameters...
│
│    # Type 2: Widget update message. For details, please refer to FormUpdatePayload.
│    └── formUpdate
│         ├── formId: Instance ID of a service widget
│         ├── version: Version number of a widget update message
│         ├── images: Image data of a service widget
│         └── Other parameters...
│
│    # Type 3: Text-to-speech message. For details, please refer to ExtensionPayload.
│    ├── notification
│    │    ├── category: Message type
│    │    ├── title: Notification title
│    │    ├── body: Notification body
│    │    └── Other parameters...
│    └── extraData: Extension data
│
│    # Other types...
│
└── target
     └── token: Push Token