Introduction
Our HTTP REST API allows you to manage vital details of your account and services in client portal. JSON is used for all API returns
Use left menu to browse trough available methods, use right menu to check required parameters, data to post and code samples in various languages.
Swagger Doc: You can download or display the JSON to generate documentation in Swagger.
Authentication
JSON Web Token Authentication
curl 'https://cp.pio.hosting/api/login' \
-d username="username"\
-d password="password"
# grab authentication token from the response and pass it in Authorization header
curl 'https://cp.pio.hosting/api/details' \
-H "Authorization: Bearer $token"
$resp = $client->post('login', [
'form_params' => [
'username' => 'username',
'password' => 'password'
]
]);
$token = $resp->json()['token'];
$resp = $client->get('details', [
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
echo $resp->getBody();
payload = username
resp = requests.post('https://cp.pio.hosting/api/login', data=payload)
headers = {
'Authorization': 'Bearer ' + req.json().token
}
resp = requests.get('https://cp.pio.hosting/api/details', headers=headers)
print(resp)
Make sure to replace
usernameandpasswordwith your client area details.
To authenticate, you need to send a JSON Web Token (JWT) in the authorization header of the HTTP request.
To obtain the authorization token you need to submit a request with your username and password
to POST https://cp.pio.hosting/api/login API method
All API calls that require authentication expect HTTP header in the form of
Authorization: Bearer <token>.
For example:
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc...
Clientarea
Login
Generate new authorization token
POST_DATA="{
\"username\": \"user@example.com\",
\"password\": \"secret\"
}"
curl -X POST "https://cp.pio.hosting/api/login" \
-H "Content-Type: application/json" \
-d "${POST_DATA}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
]);
$options = [
'json' => [
"username" => "user@example.com",
"password" => "secret"
]
]
$resp = $client->post('login', $options);
echo $resp->getBody();
payload = {
'username': "user@example.com",
'password': "secret"
}
req = requests.post('https://cp.pio.hosting/api/login', json=payload)
print(req.json())
Example Response:
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRw(...)5lZ9T79ft9uwOkqRRmIBbtR51_w",
"refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIzMD(...)ChwIAb3zvxBu6kvULa2AwAt9U-I"
}
HTTP Request
POST /login
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| username | string |
Your acount email address |
| password | string |
Account password |
Logout
Invalidate authorization token
curl -X POST "https://cp.pio.hosting/api/logout" \
-H "Authorization: Bearer $token"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$resp = $client->post('logout');
echo $resp->getBody();
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.post('https://cp.pio.hosting/api/logout', headers=headers)
print(req.json())
Example Response:
{
"status": true
}
HTTP Request
POST /logout
Refresh Token
Generate new authorization token using refresh token
POST_DATA="{
\"refresh_token\": \"refresh_tokenValue\"
}"
curl -X POST "https://cp.pio.hosting/api/token" \
-H "Content-Type: application/json" \
-d "${POST_DATA}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
]);
$options = [
'json' => [
"refresh_token" => "refresh_tokenValue"
]
]
$resp = $client->post('token', $options);
echo $resp->getBody();
payload = {
'refresh_token': "refresh_tokenValue"
}
req = requests.post('https://cp.pio.hosting/api/token', json=payload)
print(req.json())
Example Response:
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHR(...)vY2xlYiHGvauCWZD9B0VwXgHEzXDllqY",
"refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJBQ(...)Rmivc_u3YA_kgDqOPtUuGNXOzueXYtZw"
}
HTTP Request
POST /token
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| refresh_token | string |
Refresh token previously obtained from |
Revoke Token
Invalidate authorization and refresh token. Pass refresh token or call this method with valid access token
POST_DATA="{
\"refresh_token\": \"refresh_tokenValue\"
}"
curl -X POST "https://cp.pio.hosting/api/revoke" \
-H "Content-Type: application/json" \
-d "${POST_DATA}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
]);
$options = [
'json' => [
"refresh_token" => "refresh_tokenValue"
]
]
$resp = $client->post('revoke', $options);
echo $resp->getBody();
payload = {
'refresh_token': "refresh_tokenValue"
}
req = requests.post('https://cp.pio.hosting/api/revoke', json=payload)
print(req.json())
Example Response:
{
"status": true
}
HTTP Request
POST /revoke
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| refresh_token | string |
Billing
Account balance
Get current account balance(unpaid invoices total), account credit
curl -X GET "https://cp.pio.hosting/api/balance" \
-H "Authorization: Bearer $token"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$resp = $client->get('balance');
echo $resp->getBody();
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.get('https://cp.pio.hosting/api/balance', headers=headers)
print(req.json())
Example Response:
{
{
"success": true,
"details": {
"currency": "USD",
"acc_balance": "123456.55",
"acc_credit": "0.00"
}
}
}
HTTP Request
GET /balance
List Invoices
List all invoices under my account
curl -X GET "https://cp.pio.hosting/api/invoice" \
-H "Authorization: Bearer $token"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$resp = $client->get('invoice');
echo $resp->getBody();
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.get('https://cp.pio.hosting/api/invoice', headers=headers)
print(req.json())
Example Response:
{
"invoices": [
{
"id": "308976",
"date": "2016-12-30",
"dateorig": "2016-12-30",
"duedate": "2017-01-06",
"paybefore": "2017-01-06",
"total": "19.65",
"datepaid": "2016-12-30 12:40:47",
"status": "Paid",
"merge_id": null,
"number": "2016\/12\/1",
"currency": "USD"
}
]
}
HTTP Request
GET /invoice
Invoice Details
Get invoice details
curl -X GET "https://cp.pio.hosting/api/invoice/@id" \
-H "Authorization: Bearer $token"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$resp = $client->get('invoice/@id');
echo $resp->getBody();
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.get('https://cp.pio.hosting/api/invoice/@id', headers=headers)
print(req.json())
Example Response:
{
"invoice": {
"id": "308976",
"status": "Paid",
"date": "2016-12-30",
"duedate": "2017-01-06",
"paybefore": "2017-01-06",
"datepaid": "2016-12-30 12:40:47",
"subtotal": 16.24,
"credit": 0,
"tax": 3.41,
"taxrate": 21,
"tax2": 0,
"taxrate2": 0,
"taxexempt": "0",
"total": 19.65,
"rate": 1,
"rate2": 0,
"rate3": 1,
"notes": "",
"items": [
{
"id": "12305",
"invoice_id": "308976",
"type": "Other",
"item_id": "0",
"description": "Example Service",
"amount": "15.00",
"taxed": "1",
"qty": "1.00",
"linetotal": "15.00"
},
{
"id": "12309",
"invoice_id": "308976",
"type": "Other",
"item_id": "-2",
"description": "PayPal Payment Fee",
"amount": "1.24",
"taxed": "1",
"qty": "1.00",
"linetotal": "1.24"
}
],
"client": {
"id": "26",
"email": "api@example.com",
"firstname": "Joe",
"lastname": "Doe",
"companyname": "",
"address1": "Pretty View Lane",
"address2": "3194",
"city": "Santa Rosa",
"state": "California",
"postcode": "95401",
"country": "US",
"phonenumber": "+1.24123123"
},
"number": "2016\/12\/1",
"currency": "USD"
}
}
HTTP Request
GET /invoice/@id
Apply credit
Apply account credit to invoice
POST_DATA="{
\"amount\": \"amountValue\"
}"
curl -X POST "https://cp.pio.hosting/api/invoice/@id/credit" \
-H "Authorization: Bearer $token" \
-H "Content-Type: application/json" \
-d "${POST_DATA}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$options = [
'json' => [
"amount" => "amountValue"
]
]
$resp = $client->post('invoice/@id/credit', $options);
echo $resp->getBody();
payload = {
'amount': "amountValue"
}
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.post('https://cp.pio.hosting/api/invoice/@id/credit', json=payload, headers=headers)
print(req.json())
Example Response:
{
"success": true,
"invoice_status": "Paid",
"applied": 2.1
}
HTTP Request
POST /invoice/@id/credit
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| amount | number |
Optional credit amount, when no value is specified maximum amount to fully pay the invoice will be used |
Services
List services
List all services under your account
curl -X GET "https://cp.pio.hosting/api/service" \
-H "Authorization: Bearer $token"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$resp = $client->get('service');
echo $resp->getBody();
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.get('https://cp.pio.hosting/api/service', headers=headers)
print(req.json())
Example Response:
{
"services": [
{
"id": "301",
"domain": "examplename.com",
"total": "9.99",
"status": "Pending",
"billingcycle": "Monthly",
"next_due": "2017-12-30",
"category": "Hosting",
"category_url": "hosting",
"name": "Starter Hosting"
}
]
}
HTTP Request
GET /service
Service details
Return details for service @id
curl -X GET "https://cp.pio.hosting/api/service/@id" \
-H "Authorization: Bearer $token"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$resp = $client->get('service/@id');
echo $resp->getBody();
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.get('https://cp.pio.hosting/api/service/@id', headers=headers)
print(req.json())
Example Response:
{
"service": {
"id": "301",
"date_created": "2016-12-30",
"domain": "examplename.com",
"firstpayment": "9.99",
"total": "9.99",
"billingcycle": "Monthly",
"next_due": "2017-12-30",
"next_invoice": "2017-01-27",
"status": "Active",
"label": "",
"username": "examplen",
"password": "pdtzc",
"name": "Starter Hosting"
}
}
HTTP Request
GET /service/@id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Service id |
List service methods
List methods available for service
curl -X GET "https://cp.pio.hosting/api/service/@id/methods" \
-H "Authorization: Bearer $token"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$resp = $client->get('service/@id/methods');
echo $resp->getBody();
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.get('https://cp.pio.hosting/api/service/@id/methods', headers=headers)
print(req.json())
Example Response:
{
"methods": [
{
"name": "Upgrade Request",
"method": "POST",
"route": "\/service\/@id\/upgrade"
},
{
"name": "Upgrade Options",
"method": "GET",
"route": "\/service\/@id\/upgrade"
},
{
"name": "Change service label",
"method": "POST",
"route": "\/service\/@id\/label"
},
{
"name": "Service label",
"method": "GET",
"route": "\/service\/@id\/label"
},
{
"name": "Cancel Service",
"method": "POST",
"route": "\/service\/@id\/cancel"
}
]
}
HTTP Request
GET /service/@id/methods
Upgrade Options
List upgrade options
curl -X GET "https://cp.pio.hosting/api/service/@id/upgrade" \
-H "Authorization: Bearer $token"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$resp = $client->get('service/@id/upgrade');
echo $resp->getBody();
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.get('https://cp.pio.hosting/api/service/@id/upgrade', headers=headers)
print(req.json())
Example Response:
{
"resources": [
{
"id": 1557,
"name": "Bandwidth",
"type": "select",
"items": [
{
"id": "9953",
"name": "100 GB",
"price": 1,
"setup_price": 0,
"selected": true
},
{
"id": "10103",
"name": "500 GB",
"price": 5,
"setup_price": 0,
"selected": false
},
{
"id": "10104",
"name": "1 TB",
"price": 10,
"setup_price": 0,
"selected": false
}
]
}
],
"package": []
}
HTTP Request
GET /service/@id/upgrade
Upgrade Request
Estimate or request upgrade
// Format of ''resources'' paremeter
{
"resource_id" : "qty_value", // sliders & qty fields
"resource_id" : "item_id", // dropdown & radio fields
"resource_id" : {
"item_id": "qty_value" // dropdown with qty field
}
}
POST_DATA="{
\"id\": \"idValue\",
\"resources\": \"resourcesValue\",
\"package\": \"packageValue\",
\"cycle\": \"cycleValue\",
\"send\": \"sendValue\"
}"
curl -X POST "https://cp.pio.hosting/api/service/@id/upgrade" \
-H "Authorization: Bearer $token" \
-H "Content-Type: application/json" \
-d "${POST_DATA}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$options = [
'json' => [
"id" => "idValue",
"resources" => "resourcesValue",
"package" => "packageValue",
"cycle" => "cycleValue",
"send" => "sendValue"
]
]
$resp = $client->post('service/@id/upgrade', $options);
echo $resp->getBody();
payload = {
'id': "idValue",
'resources': "resourcesValue",
'package': "packageValue",
'cycle': "cycleValue",
'send': "sendValue"
}
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.post('https://cp.pio.hosting/api/service/@id/upgrade', json=payload, headers=headers)
print(req.json())
HTTP Request
POST /service/@id/upgrade
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Service id |
| resources | array |
array with resource values |
| package | int |
New package id, optonal when upgrading resources |
| cycle | string |
New billing cycle, optonal when upgrading resources |
| send | boolean |
Set to true when you want to send your upgrade request |
Cancel Service
Request service cancellation
POST_DATA="{
\"id\": \"idValue\",
\"immediate\": \"immediateValue\",
\"reason\": \"reasonValue\"
}"
curl -X POST "https://cp.pio.hosting/api/service/@id/cancel" \
-H "Authorization: Bearer $token" \
-H "Content-Type: application/json" \
-d "${POST_DATA}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$options = [
'json' => [
"id" => "idValue",
"immediate" => "immediateValue",
"reason" => "reasonValue"
]
]
$resp = $client->post('service/@id/cancel', $options);
echo $resp->getBody();
payload = {
'id': "idValue",
'immediate': "immediateValue",
'reason': "reasonValue"
}
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.post('https://cp.pio.hosting/api/service/@id/cancel', json=payload, headers=headers)
print(req.json())
Example Response:
{
"info": [
"cancell_sent"
]
}
HTTP Request
POST /service/@id/cancel
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Service id |
| immediate | string |
set to |
| reason | string |
Reason for this request |
Service label
Show current service label
curl -X GET "https://cp.pio.hosting/api/service/@id/label" \
-H "Authorization: Bearer $token"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$resp = $client->get('service/@id/label');
echo $resp->getBody();
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.get('https://cp.pio.hosting/api/service/@id/label', headers=headers)
print(req.json())
Example Response:
{
"label": "example"
}
HTTP Request
GET /service/@id/label
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Service id |
Change service label
Set new custom label to identify this service
POST_DATA="{
\"id\": \"idValue\",
\"label\": \"labelValue\"
}"
curl -X POST "https://cp.pio.hosting/api/service/@id/label" \
-H "Authorization: Bearer $token" \
-H "Content-Type: application/json" \
-d "${POST_DATA}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$options = [
'json' => [
"id" => "idValue",
"label" => "labelValue"
]
]
$resp = $client->post('service/@id/label', $options);
echo $resp->getBody();
payload = {
'id': "idValue",
'label': "labelValue"
}
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.post('https://cp.pio.hosting/api/service/@id/label', json=payload, headers=headers)
print(req.json())
Example Response:
{
"success": true,
"info": [
"label_updated"
]
}
HTTP Request
POST /service/@id/label
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int |
Service id |
| label | string |
New label |
Cart
Most of API methods found here will require service @id, you can lookup your service ids with /service method
List product categories
Return a list of product categories.
curl -X GET "https://cp.pio.hosting/api/category" \
-H "Authorization: Bearer $token"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$resp = $client->get('category');
echo $resp->getBody();
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.get('https://cp.pio.hosting/api/category', headers=headers)
print(req.json())
Example Response:
{
"categories": [
{
"id": "10",
"name": "Hosting",
"description": "",
"slug": "hosting"
},
{
"id": "6",
"name": "Domains",
"description": "",
"slug": "domains"
},
{
"id": "16",
"name": "Dedicated",
"description": "",
"slug": "dedicated"
}
]
}
HTTP Request
GET /category
List products in category
Return a list of product available for purchase under requested category
curl -X GET "https://cp.pio.hosting/api/category/@category_id/product" \
-H "Authorization: Bearer $token"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$resp = $client->get('category/@category_id/product');
echo $resp->getBody();
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.get('https://cp.pio.hosting/api/category/@category_id/product', headers=headers)
print(req.json())
Example Response:
{
"products": [
{
"id": "333",
"type": "1",
"name": "Starter Hosting",
"stock": false,
"paytype": "Regular",
"description": "Disk:10GB
Memory:2GB
MySql:10 DB
Email:100 Users
",
"qty": "0",
"tags": [
],
"periods": [
{
"title": "m",
"value": "m",
"price": 9.99,
"setup": 0,
"selected": true
},
{
"title": "a",
"value": "a",
"price": 109.89,
"setup": 0,
"selected": false
},
{
"title": "b",
"value": "b",
"price": 199.8,
"setup": 0,
"selected": false
},
{
"title": "t",
"value": "t",
"price": 299.7,
"setup": 0,
"selected": false
}
]
},
(...)
]
}
HTTP Request
GET /category/@category_id/product
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| category_id | int |
Category ID |
Get product configuration details
Return product details with form configuration, addons and subproducts if available.
curl -X GET "https://cp.pio.hosting/api/order/@product_id" \
-H "Authorization: Bearer $token"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$resp = $client->get('order/@product_id');
echo $resp->getBody();
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.get('https://cp.pio.hosting/api/order/@product_id', headers=headers)
print(req.json())
Example Response:
{
"product": {
"id": "333",
"category_name": "Hosting",
"category_id": "49",
"name": "Starter Hosting",
"price": 9.99,
"recurring": "m",
"setup": 0,
"config": {
"product": [
{
"type": "select",
"title": "pickcycle",
"id": "cycle",
"name": "cycle",
"items": [
{
"title": "m",
"value": "m",
"price": 9.99,
"setup": 0,
"selected": true
},
{
"title": "a",
"value": "a",
"price": 109.89,
"setup": 0,
"selected": false
},
{
"title": "b",
"value": "b",
"price": 199.8,
"setup": 0,
"selected": false
},
{
"title": "t",
"value": "t",
"price": 299.7,
"setup": 0,
"selected": false
}
],
"value": "m",
"price": 9.99,
"setup": 0
},
{
"type": "input",
"title": "domain",
"id": "domain",
"name": "domain",
"value": null
}
],
"forms": [
{
"type": "select",
"title": "Disk Size",
"id": "1618",
"firstItemId": 10330,
"description": "",
"name": "custom[1618]",
"required": false,
"multiple": false,
"config": {
"conditionals": []
},
"value": [],
"textvalue": [],
"price": 0,
"recurring_price": 0,
"setup": 0,
"prorata_date": null,
"items": [
{
"title": "512MB",
"value": 1,
"id": 10330,
"price": 0,
"setup": 0,
"selected": false
},
{
"title": "1GB",
"value": 1,
"id": 10331,
"price": 0,
"setup": 0,
"selected": false
},
{
"title": "2GB",
"value": 1,
"id": 10332,
"price": 0,
"setup": 0,
"selected": false
}
]
},
(...)
],
"addons": [
{
"type": "subitem",
"title": "Cpanel2: Add Extra IP",
"id": "31",
"value": null,
"description": "Automatically adds IP address to account",
"config": [
{
"type": "checkbox",
"title": "add",
"name": "addon[31]",
"checked": false
},
{
"type": "select",
"title": "billingcycle",
"name": "addon_cycles[31]",
"items": [
{
"title": "m",
"value": "m",
"price": 5,
"setup": 0,
"selected": true
},
{
"title": "q",
"value": "q",
"price": 20,
"setup": 0,
"selected": false
},
{
"title": "a",
"value": "a",
"price": 50,
"setup": 0,
"selected": false
}
]
}
],
"price": 0,
"recurring_price": 0,
"setup": 0,
"prorata_date": null
},
(...)
],
"subproducts": []
},
"recurring_price": 9.99,
"prorata_date": null
}
}
HTTP Request
GET /order/@product_id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| product_id | int |
Product ID |
Order new service
Create and submit new order for selected product.
To get available cycle and configuration options lookup product details
using GET /order/@product_id
POST_DATA="{
\"product_id\": 12,
\"domain\": \"example.com\",
\"cycle\": \"m\",
\"pay_method\": \"1\",
\"custom\": {
\"1618\": {
\"10330\": 1
}
},
\"promocode\": \"T346F\"
}"
curl -X POST "https://cp.pio.hosting/api/order/@product_id" \
-H "Authorization: Bearer $token" \
-H "Content-Type: application/json" \
-d "${POST_DATA}"
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://cp.pio.hosting/api/',
'headers' => [
'Authorization' => 'Bearer ' . $token
]
]);
$options = [
'json' => [
"product_id" => 12,
"domain" => "example.com",
"cycle" => "m",
"pay_method" => "1",
"custom" => [
1618 => [
10330 => 1
]
],
"promocode" => "T346F"
]
]);
$resp = $client->post('order/@product_id', $options);
echo $resp->getBody();
payload = {
'product_id': 12,
'domain': "example.com",
'cycle': "m",
'pay_method': "1",
'custom': {
'1618': {
'10330': 1
}
},
'promocode': "T346F"
}
headers = {
'Authorization': 'Bearer ' + token
}
req = requests.post('https://cp.pio.hosting/api/order/@product_id', json=payload, headers=headers)
print(req.json())
Example Response:
{
"order_num": 873340995,
"invoice_id": "308979",
"total": "9.99",
"items": {
"id": "10",
"type": "Hosting",
"name": "test.com",
"product_id": "3"
}
}
HTTP Request
POST /order/@product_id
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| product_id | int |
Product ID |
| domain | string |
Domain name, ie. example.com, may be optional |
| cycle | string |
Billing period symbol |
| pay_method | int |
Payment method ID |
| custom | array |
Additional options data available for sop products |
| promocode | string |
Promotion code |