Request Structure

This topic introduces the structure of REST API requests, including request header, request method, and request URL.

The REST API is served over HTTPS. To ensure data privacy, unencrypted HTTP is not supported.

See the following HTTP request of Query a specific PBX as a request example.

GET /api/v1/pbx/instances/197 HTTP/1.1
Host: ympapi.yeastarcloud.com
Authorization: Bearer {access_token}
Cache-Control: no-cache
  • GET specifies the request method.
  • Host: ympapi.yeastarcloud.com specifies the YMP domain.
  • api/v1/pbx/instances/197 is the endpoint URI of querying a specific PBX.
  • Autheorization: Bearer {access_token} is used to authenticate the request.

Authenticate Requests

To request an API endpoint, you must add the Authorization in the HTTP header. Then, the authorization server allows you to make REST API requests.

Authorization Format:

Authorization : Bearer {access_token}

Authorization Example:

Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2dpbl9uYW1lIjoieW1wQHllYXN0YXIuY29tIiwic2NvcGUiOlsidHJ1c3QiXSwiZXhwIjoxNTQ0NzczMjA0LCJhdXRob3JpdGllcyI6WyJST0xFX2FkbWluIl0sImp0aSI6IjlhZTZlNDlhLTc3NTMtNDA0Yi1hMzE2LTg2OTMwYjEwYTc0ZiIsImNsaWVudF9pZCI6IjlkNjUxNTI1NDAwNGY5ZGFhMGQ4YWY3ZDgxMWU4OWM2In0.5SclxQ7LVZVa7zYspuqwnnUKtuhOsT35aw698KkGn-c

Request Method

  • GET - to query information.
  • POST - to add users, add PBXs, add customers, or send emails.
  • PUT - to update configurations.
  • DELET - to delete users, PBXs, or customers.

Request URL

The format of HTTP request URL:

{base_url}{endpoint}

Base URL

All URLs referenced in the documentation have the following base:

https://{ymp_domain}

Endpoint

  • Endpoint format of authorization requests: /oauth/**
  • Endpoint format of other requests: /api/v1/**

See the overview of REST API endpoints.