Tutorial: Get Free Trial License for P-Series Software Edition Using API
This tutorial introduces the request parameters and provides a request example to show you how to get a free trial license for P-Series Software Edition using API.
Before you begin: Understand the request parameters
Before getting a free trial license 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 that you want to try. The Product ID
for P-Series Software Edition is
|
| Partner ID | partnerId |
Specify the user for whom you want to request for the
trial. Note: This parameter is required
only when you request for a subordinate user. You will need
to query the information as described in the following
steps. |
| Assign ID | assignId |
Optional. Specify the subordinate user who can receive the
PBX activation email after you apply for the trial. Note: By default, only you will receive the
activation email. To send the activation email to a
subordinate user as well, you will need to query the
subordinate user ID as described in the following
steps. |
| Plan Type & Service Type |
serviceType |
|
| Plan ID & Service ID | serviceId |
Specify the specific plan and service that you want to
try. You will need to query the information as described in the following steps. |
| Connection Plan ID | connectionPlanId |
Optional. Specify the specific plan that you want to
try.
Note: This parameter is
required only when you try out both plan and service,
and it should be the same as Plan ID. |
| Purchase Type | purchaseType |
The purchase type. In this scenario, the value is fixed at
|
| Multi Cycle | multiCycle |
The interval of recurring billing. In this scenario, the
value is fixed at |
(Optional) Step 1. Get subordinate user ID
- Make a request to the Query Subordinate User List API endpoint.
GET {base_url}/user/openapi/user/v1/client/partner_list - Note down the returned value of
partnerIdfor the desired subordinate user.
Step 2. Get 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
12.GET {base_url}/pricing/openapi/purchase/v1/purchase_product_info?productId=12 - Note down the returned value of
planIdandserviceIdfor the desired plan and service.
Step 3. Request a free trial license 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 | Description |
|---|---|---|
| Operation Type | operationType |
trial_plan |
| Product ID | productId |
12 |
| Assign ID | assignId |
3196166858895147008 |
| Plan Type & Plan ID | serviceType &
serviceId |
|
| Service Type & Service ID | serviceType &
serviceId |
Note: Disaster
Recovery is only supported on
Ultimate Plan.
|
| Connection Plan ID | connectionPlanId |
3049041101760282624 (ID for Ultimate Plan) |
| Purchase Type | purchaseType |
trial |
| Multi Cycle | multiCycle |
0 |
The sample request to get a free trial license with Ultimate Plan and Disaster Recovery service 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": "trial_plan",
"productId": 12,
"serviceList": [
{
"serviceType": "plan",
"serviceId": 3049041101760282624,
"purchaseType": "trial",
"multiCycle": 0
},
{
"connectionPlanId":3049041101760282624,
"serviceType": "service",
"serviceId": 3129372068699893760,
"purchaseType": "trial",
"multiCycle": 0
},
]
"assignId": "3196166858895147008"
}
Result
A sample response is shown below:
{
"code": "success",
"detailMessage": "",
"requestId": "4328683fa8c726805d3c93a355bf2a0b",
"result": {
"instanceId": "1282391",
"orderNo": "",
"orderStatus": "succeed",
"productNo": "3651E1292455",
"transactionNo": ""
},
"status": 200
}