Request Structure

The request URL consists of several parameters, such as host URL, API version, access token, API endpoint and required parameters. This topic describes the request structure, including request methods and request URL format.

Request example

Important: You MUST include a User-Agent header with every request that you submit to the Yeastar P-Series Cloud Edition API, so that the PBX can identify your application and respond to the request. For example, User-Agent: OpenAPI.

Below is a request example of Edit an Extension.

POST /openapi/v1.0/extension/update?access_token=5SwyByhbSfsNlpI1v4GtHxEDmKsZwzjQ HTTP/1.1 

Host: yeastardocs.example.yeastarcloud.com
Content-Type: application/json
User-Agent: OpenAPI
{
    "id": 60,
    "presence_status":"off_work"
}
  • POST indicates the request method.
  • openapi/v1.0 is the API path that indicates the API version.
  • extension/update indicates the target API endpoint of Edit an Extension.
  • access_token=5SwyByhbSfsNlpI1v4GtHxEDmKsZwzjQ is the access token used for authentication.
  • HTTP/1.1 is the Hypertext Transfer Protocol.
  • Host indicates the domain name of Yeastar P-Series Cloud Edition.
  • Content-Type:application/json indicates the format of request content.
  • id and presence_status are the request parameters of Edit an Extension.

Request methods

Yeastar P-Series Cloud Edition API supports the following request methods:
  • GET - to query information or execute delete operations.
  • POST - to add an object or execute specific operations.

Request URL format

The request URL format is as follows:

{base_url}/{api_path}/{endpoint}?access_token={access_token}
Note: No access token is needed in the request URL of Get Access Token and Refresh Access Token.
{base_url}

All URLs referenced in the documentation have the following base URL:

https://{pbx_domain}
{api_path}
The format of API path is openapi/{version}; the {version} indicates the API version.
All URLs referenced in the documentation use API version v1.0, and the API path is openapi/v1.0.
{endpoint}

Endpoint indicates the specific address of API request.

Refer to API Interfaces & Events Summary for all available API endpoints on Yeastar P-Series Cloud Edition.

{access_token}

Access token is used to authenticate API requests. The third-party application should Get Access Token before calling APIs. Each subsequent request requires the access token for authentication.

For detailed API authentication, see Authorization Rule.