Call Cloud PBX POST API

Call the HTTP POST API endpoints of a P-Series Cloud PBX via the YCM API. This topic uses editing an organization on the specified Cloud PBX as an example.

Requirements

Platform Requirements
Yeastar Central Management
P-Series Cloud PBX

Request URL

POST {base_url}/dm/open_api/v1/cloud_pbx/{sn}/**
Note:

The ** in the request URL acts as a path wildcard, representing the specific Cloud PBX API endpoint to be called.

In this example, replace the ** wildcard with openapi/{version}/organization/update, where {version} indicates the Cloud PBX API version.

For more Cloud PBX API endpoints, see P-Series Cloud Edition Developer Guide.

Request parameters

Path parameter
Parameter Required Type Description
sn Yes String The Serial Number (SN) of the Cloud PBX.
Note: You can query the Cloud PBX SN using Query All the Cloud PBXs.
Headers
Parameter Required Type Description
Authorization Yes String Pass the access token in the header.

Format: Bearer {access_token}.

Body

The body contains the necessary request parameters for the target Cloud PBX API endpoint.

In this example, fill in the request parameters for editing an organization as follows.

Parameter Required Type Description
id Yes Integer The unique ID of an organization.
Note: You can query the organization's ID using the Cloud PBX API endpoint for searching specific organizations.
name No String Organization name.
parent_id No Integer Parent organization ID.
Note: You can query the organization's ID using the Cloud PBX API endpoint for searching specific organizations.

Response parameters

The response parameters consist of the request ID for the YCM API call and the data returned from the target Cloud PBX API endpoint.

In this example, the request ID and the response parameters for editing an organization are returned, as shown in the following table.

Parameter Type Description
requestId String The unique ID of the request, which can be used to quickly locate the request.
errcode Integer Returned error code of the Cloud PBX API endpoint.
  • 0: Succeed
  • Non-zero value: Failed.
Note: You can check the error code and error message of the Cloud PBX API in Error Code and Error Message.
errmsg String Returned error message of the Cloud PBX API endpoint.
  • SUCCESS: Succeed.
  • FAILURE: Failed.

Example

Request example

Editing the name of an organization (ID: 2) on the specified Cloud PBX.

POST /dm/open_api/v1/cloud_pbx/3658B43XXXXXM4ZK/openapi/v1.0/organization/update HTTP/1.1
Host: ycm.yeastar.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21Kd3RQYXlsb2FkSW5mbyI6eyJncmFudFR5cGUiOiJjbGllbnRfY3JlZGVudGlhbHMiLCJ5c0lkIjoxNzg5NjM2MDM5MDg1MDI1NjY0NSwidmVyc2lvbiI6MTY2Mzc0MTEyNSwicmVmcmVzaFZlcnNpb24iOjE2NjQ0NTAxOTh9LCJzY29wZSI6WyJhbGwiXSwiZXhwIjoxNjY0NDUxOTk4LCJhdXRob3JpdGllcyI6WyJST0xFX0NMSUVOVCJdLCJqdGkiOiJmNzAzYjk0Ni1kMzk4LTQxZWEtOTgwZi1hOGZmNWYxODhiNDAiLCJjbGllbnRfaWQiOiJ5QXN4ZzdITkRFczNxSHprQk1aUU5Pblo2NTBPRUNNWSJ9.N9R6s5ttSah3LRdDBowQYdYw8URWhzyJYiD5cdVm2ZM
Content-Type: application/json
{
    "id": 2,
    "name":"Technical Support"
}
Response example
HTTP/1.1 200 OK
{
    "errcode": 0,
    "requestId": "218ffc1e5e4564c0c3b09e576cf91f64",
    "errmsg": "SUCCESS"
}