Call Cloud PBX GET API

Call the HTTP GET API endpoints of a P-Series Cloud PBX via the YCM API. This topic uses querying the password of an extension on the specified Cloud PBX as an example.

Requirements

Platform Requirements
Yeastar Central Management
P-Series Cloud PBX

Request URL

GET {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}/extension/getpassword, 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}.

Query parameters

The query parameters contain the necessary request parameters for the target Cloud PBX API endpoint.

In this example, fill in the request parameters for querying password of an extension as follows.

Parameter Required Type Description
id Yes Integer The unique ID of an extension.
Note: You can query the extension's ID using the Cloud PBX API endpoint for searching specific extensions.
type Yes String Password type.
Valid value:
  • reg_password: Registration password.
  • vm_pin: Voicemail access PIN.

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 querying password of an extension 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.
password String Registration password or voicemail access PIN of the specified extension.
Note: You can use a Base64 decoding tool to convert the password back to its original form.

Example

Request example

Query the registration password of an extension (ID: 43) on the specified Cloud PBX.

GET /dm/open_api/v1/cloud_pbx/3658B43XXXXXM4ZK/openapi/v1.0/extension/getpassword?id=43&type=reg_password HTTP/1.1
Host: ycm.yeastar.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21Kd3RQYXlsb2FkSW5mbyI6eyJncmFudFR5cGUiOiJjbGllbnRfY3JlZGVudGlhbHMiLCJ5c0lkIjoxNzg5NjM2MDM5MDg1MDI1NjY0NSwidmVyc2lvbiI6MTY2Mzc0MTEyNSwicmVmcmVzaFZlcnNpb24iOjE2NjQ0NTAxOTh9LCJzY29wZSI6WyJhbGwiXSwiZXhwIjoxNjY0NDUxOTk4LCJhdXRob3JpdGllcyI6WyJST0xFX0NMSUVOVCJdLCJqdGkiOiJmNzAzYjk0Ni1kMzk4LTQxZWEtOTgwZi1hOGZmNWYxODhiNDAiLCJjbGllbnRfaWQiOiJ5QXN4ZzdITkRFczNxSHprQk1aUU5Pblo2NTBPRUNNWSJ9.N9R6s5ttSah3LRdDBowQYdYw8URWhzyJYiD5cdVm2ZM
Response example
HTTP/1.1 200 OK
{
    "errcode": 0,
    "password": "NVVVYzVPRTU4aw==",
    "requestId": "563b171e03953491f196c1478df3d539",
    "errmsg": "SUCCESS"
}