Request Structure
This topic describes the structure of YCM API requests, including request header, request method, and request URL.
Note: The YCM API is served over HTTPS. To ensure data privacy,
unencrypted HTTP is not supported.
Request example
Note: You MUST include a User-Agent header with every
request that you submit to the YCM API, so that the Yeastar Central Management can
identify your application and respond to the request. For example,
User-Agent: OpenAPI
.A request example is shown as below, which is a request of Query All the Cloud PBXs.
GET /dm/open_api/v2/cloud_pbx/instances HTTP/1.1
Host: ycm.yeastar.com
User-Agent: OpenAPI
Authorization: Bearer {access_token}
GET
specifies the request method./dm/open_api/v2/cloud_pbx/instances
is the target API endpoint of querying all the P-Series Cloud PBXs.HTTP/1.1
is the Hypertext Transfer Protocol.Host:ycm.yeastar.com
specifies the YCM domain.Authorization: Bearer {access_token}
is used to authenticate the request.
Authenticate requests
To request an API endpoint, you must add the access token to the Authorization field in the HTTP header. In this way, the authorization server allows you to make REST API requests.Authorization Format
Authorization: Bearer {access_token}
Authorization
Example
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21Kd3RQYXlsb2FkSW5mbyI6eyJncmFudFR5cGUiOiJjbGllbnRfY3JlZGVudGlhbHMiLCJ5c0lkIjoxNzg5NjM2MDM5MDg1MDI1NzM0OSwicmVmcmVzaFZlcnNpb24iOjE2Mzg5NDM5MTJ9LCJzY29wZSI6WyJhbGwiXSwiZXhwIjoxNjM4OTQ1NzEyLCJhdXRob3JpdGllcyI6WyJST0xFX0NMSUVOVCJdLCJqdGkiOiJhNzgwMTA3Yi0wOGE1LTRmM2YtODY4Yi04NjFmMjUxOWUxMzAiLCJjbGllbnRfaWQiOiJrcDl5eW50bXVlc3VrNWpvV3ZNa1RiQ0J4cU82TEtSaCJ9.iX7FMOQQKuiKLCNO8wBtnKz6n3Ydv-OFtcut3j8JV-o
Request methods
YCM API supports the following request methods:
HTTP method | Usage |
---|---|
GET | Query information. |
POST | Add an object or execute specific operations. |
PUT | Update or modify configurations. |
DELETE | Delete specific objects. |
Request URL
The request URL format is as
follows:
{base_url}/{endpoint}
- {base_url}
-
All URLs referenced in the documentation have the following base URL:
https://{ycm_domain}
- {endpoint}
- Endpoint indicates the specific address of API request.