Tutorial: Subscribe to Service for P-Series Software Edition Using API
This tutorial introduces the request parameters and provides a request example to show you how to subscribe to service for P-Series Software Edition using API.
Before you begin: Understand the request parameters
Before subscribing to service for P-Series Software Edition using API, we recommend that you read the table below to understand the request parameters and collect the corresponding values.
| Item | Parameter | Description |
|---|---|---|
| Operation Type | operationType |
The operation type. In this scenario, the value is fixed at
|
| Product ID | productId |
Specify the product for which you want to subscribe to
service. The Product ID for P-Series Software Edition is
|
| PBX Serial Number (SN) | productNo |
Specify the device for which you want to subscribe to
service. You will need to query the PBX SN as described in the following steps. |
| Billing Contact ID | billingId |
Specify the contact who can receive the invoice after you
subscribe to service. You will need to query the Billing Contact ID as described in the following steps. |
| Connection Plan ID | connectionPlanId |
Specify the current subscription plan. You will need to query the Connection Plan ID as described in the following steps. |
| Service Type | serviceType |
The service type. In this scenario, the value is fixed at
|
| Service ID | serviceId |
Specify the specific service to which you want to
subscribe. You will need to query the Service ID as described in the following steps. Note: Disaster
Recovery is only supported on
Ultimate Plan.
|
| Quantity | quantity |
Specify the number of items that you want to purchase, typically required when subscribing to services such as outbound call center, AI transcription, AI receptionist, etc. You will need to query the valid values as described in the following steps. |
| Purchase Type | purchaseType |
The purchase type. In this scenario, the value is fixed at
|
| Billing Model | billingModel |
The billing model. In this scenario, the value is fixed at
|
| Billing Cycle | billingCycle |
The billing cycle. In this scenario, the value is fixed at
|
Step 1. Get Serial Number (SN)
- Make a request to the Query Product List API endpoint with the Product
ID
12.GET {base_url}/product/openapi/instance_product/v1/client/instance_product_list?productId=12 - Note down the returned value of
productNofor the desired Software PBX.
Step 2. Get connection plan ID and service ID
- Make a request to the Query Available Subscription / Trial Plans and Services for a Product API endpoint with the Product ID
12and the PBX SN.GET {base_url}/pricing/openapi/purchase/v1/purchase_product_info?productId=12&productNo={PBX_SN} - Note down the returned values of
planIdfor the current subscription plan andserviceIdfor the desired service.
Step 3. Get purchase limit
- Make a request to the Query Information about the Plan Available for Subscription API endpoint with the Product ID
12,pricingPlanId, and PBX SN. - Note down the returned values of
purchaseInputfor both plan and service.
Step 4. Get billing contact ID
- Make a request to the Query Billing Contact List API endpoint.
GET {base_url}/user/openapi/user/v1/client/billing_contact_list - Note down the returned value of
billingContactIdfor the desired billing contact.
Step 5. Subscribe to service for P-Series Software Edition
Make a request to the Create an Order API endpoint with the collected values.
POST {base_url}/order/openapi/order/v1/save
In this tutorial, the values we collect are shown below:
| Item | Parameter | Value |
|---|---|---|
| Operation Type | operationType |
purchase_service |
| Product ID | productId |
12 |
| PBX Serial Number (SN) | productNo |
3651D3296882 |
| Billing Contact ID | billingId |
3197218168379846218 |
| Connection Plan ID | connectionPlanId |
3049040650094403584 (ID for Enterprise Plan) |
| Service Type | serviceType |
service |
| Service ID | serviceId |
3115983610256539648 (ID for Hotel PMS Integration service) |
| Purchase Type | purchaseType |
purchase |
| Billing Model | billingModel |
recurring |
| Billing Cycle | billingCycle |
annually |
The sample request to subscribe to Hotel PMS Integration service for P-Series Software Edition is shown below:
POST /order/openapi/order/v1/save HTTP/1.1 Host: openapi.partner.yeastar.com Content-Type: application/json User-Agent: OpenAPI Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsicmVzMSJdLCJYLU1TLVVTRVIiOiJ7XCJleHByXCI6XCIwXCIsXCJ0eXBlXCI6XCJwYXJ0bmVyXCIsXCJ1Y0lkXCI6XCIzMDc2OTE1NDU0NDY4NzY3NzQ0XCIsXCJ1c2VyQ29kZVwiOlwiUGFydG5lclwiLFwidXNlcklkXCI6XCIzMDc2OTE1NDU0NDg5NzM5MjY0XCIsXCJ1c2VybmFtZVwiOlwicGFydG5lcmV4YW1wbGVAb3V0bG9vay5jb21cIn0iLCJ1c2VyX25hbWUiOiJwYXJ0bmVyZXhhbXBsZUBvdXRsb29rLmNvbSIsInNjb3BlIjpbImFsbCJdLCJleHAiOjE3Mzk3MTc5MjYsInRva2VuX3R5cGUiOiJvcGVuYXBpIiwianRpIjoidmlzMkh0QkxaUStNQmxPbS9UdThWR1pyNFljPSIsImF1dGhvcml0aWVzIjpbIjc5Il0sImNsaWVudF9pZCI6IjE0NDI5NjM2ODBiMjM0YjA0YmRjZDVjMTZmODcyOWQ2In0.RPRoTJRkXCB4krDSwGRpUFyCfUVv2LHjIiBICA1pCiY { "operationType": "purchase_service", "productId": 12, "productNo": "3651D3296882", "billingId": 3197218168379846218, "serviceList": [ { "connectionPlanId":3049040650094403584, "serviceType": "service", "serviceId": 3115983610256539648, "purchaseType": "purchase", "billingModel": "recurring", "billingCycle": "annually" } ] }
Result
The sample response is shown below:
{
"code": "success",
"detailMessage": "",
"requestId": "59d974128ae8b000e0ab1a907dc96a13",
"result": {
"instanceId": "1088407",
"orderNo": "UO3206271046934061056",
"orderStatus": "succeed",
"productNo": "3651D3296882",
"transactionNo": "DA3206271048116854785"
},
"status": 200
}