curl -X <method> https://api.clients.vndata.vn/api/<action> -u "<user_email>:<user_pass>" -H "Content-Type: application/json"
Trong đó:
curl -X <method> https://api.clients.vndata.vn/api/<action> -u "<user_email>:<user_pass>" -H "Content-Type: application/json" | jq
curl -X <method> https://api.clients.vndata.vn/api/<action> -u "<user_email>:<user_pass>" -H "Content-Type: application/json" | json_pp
curl -X GET https://api.clients.vndata.vn/api/clients/ -u "<user_email>:<user_pass>" -H "Content-Type: application/json"
{
"message" : {
"address1" : "61/3 Bình Giã, P. 13, Q. Tân Bình, TP. HCM",
"address2" : "",
"cardtype" : "Visa",
"city" : "Hồ Chính Minh",
"client_id" : "479",
"country" : "VN",
"countryname" : "Viet Nam",
"datecreated" : "2023-04-03",
"email" : "vantien3111@gmail.com",
"firstname" : "Văn Tiến",
"lastlogin" : "2024-01-08 21:40:50",
"lastname" : "Hồ Văn Tiến",
"phonenumber" : "+84 368548741",
"postcode" : "",
"state" : "TP. HCM",
"status" : "Active"
},
"success" : true
}
curl -X GET https://api.clients.vndata.vn/api/orders/ -u "<user_email>:<user_pass>" -H "Content-Type: application/json"
{
"message" : [
{
"balance" : "Completed",
"date_created" : "2023-05-09 09:34:09",
"id" : "1498", --> Biến @order_id
"invtotal" : "",
"module" : "Chuyển khoản nhanh 247 quét QR",
"status" : "Active",
"total" : "0"
},
{
"balance" : "Cancelled",
"date_created" : "2023-04-03 10:58:30",
"id" : "1353", --> Biến @order_id
"invtotal" : "154000",
"module" : "Chuyển khoản nhanh 247 quét QR",
"status" : "Active",
"total" : "154000"
}
],
"success" : true
}
curl -X GET https://api.clients.vndata.vn/api/orders/@order_id/ -u "<user_email>:<user_pass>" -H "Content-Type: application/json"
{
"message" : [
{
"billingcycle" : "Monthly",
"category_id" : "22",
"catname" : "VPS Storage",
"commitment_date" : "",
"domain" : "nextcloud1",
"id" : "2613",
"name" : "VPS Stor-3",
"password" : "o_AWEgJdAMY_",
"product_id" : "124", --> Biến @product_id
"status" : "Active",
"username" : "client_479_13"
}
],
"success" : true
}
curl -X POST https://api.clients.vndata.vn/api/orders/@product_id/ -u "<user_email>:<user_pass>" -H "Content-Type: application/json" -d '{"cycle":"m","domain":"domain_name"}'
{
"message": [
{
"billingcycle": "Monthly",
"catname": "VPS Windows",
"commitment_date": "",
"domain": "traioi-test",
"id": "2515",
"name": "VPS W2 MT",
"password": "FiUY_jOMpq5_",
"product_id": "269",
"status": "Pending",
"username": "traioitq"
}
],
"success": true
}
curl -X GET https://api.clients.vndata.vn/api/services/ -u "<user_email>:<user_pass>" -H "Content-Type: application/json"
{
"accounts" : [
{
"billingcycle" : "Monthly",
"client_id" : "479",
"companyname" : "",
"component_form_name" : "",
"component_value_name" : "",
"currency_id" : "0",
"domain" : "nextcloud1",
"extra_details" : {
"usage" : {
"capped" : false,
"current" : {
"data_received" : 0,
"data_sent" : 0
},
"current_unit" : "GB",
"end" : "2024-01-22 00:00:00",
"lasttime" : 0,
"log" : [],
"migrated" : true,
"notified" : false,
"previous" : "2023-11-22",
"suspended" : false,
"vmdata" : {
"20263" : {
"hourly" : [],
"lasttime" : "",
"netin" : 0,
"netout" : 0,
"rate" : "",
"total" : {
"data_received" : 0,
"data_sent" : 0
},
"uptime" : 0
}
}
}
},
"firstname" : "Văn Tiến",
"group_id" : "0",
"id" : "2613", --> Biến @service_id
"lastname" : "Hồ Văn Tiến",
"manual" : "0",
"name" : "VPS Stor-3",
"next_due" : "0000-00-00",
"paytype" : "Regular",
"product_id" : "124",
"qty" : "1",
"service_group_id" : "0",
"status" : "Active",
"total" : "0",
"type" : "3"
}
],
"server_time" : 1704763856,
"sorter" : {
"perpage" : 10,
"sorterpage" : 1,
"sorterrecords" : "11",
"totalpages" : 2
},
"success" : true
}
curl -X GET https://api.clients.vndata.vn/api/services/@service_id/ -u "<user_email>:<user_pass>" -H "Content-Type: application/json"
{
"message" : {
"billingcycle" : "Monthly",
"billingtype" : "PrePay",
"category_id" : "22",
"category_name" : "VPS Storage",
"client_id" : "479",
"date_created" : "2023-12-22",
"date_suspended" : "0000-00-00",
"domain" : "nextcloud1",
"next_due" : "0000-00-00",
"order_id" : "2295",
"password" : "o_AWEgJdAMY_",
"product_name" : "VPS Stor-3",
"status" : "Active",
"vmid" : "20263",
"vpsip" : "103.144.87.151"
},
"success" : true
}
curl -X DELETE https://api.clients.vndata.vn/api/services/@service_id/ -u "<user_email>:<user_pass>" -H "Content-Type: application/json"
{
"info": [
"Function has been scheduled for execution"
],
"server_time": 1700992130,
"success": true
}
curl -X GET https://api.clients.vndata.vn/api/services/@service_id/vms/ -u "<user_email>:<user_pass>" -H "Content-Type: application/json"
{
"message": [
{
"cpu": 0,
"cpus": 2,
"disk": 0,
"diskread": 0,
"diskwrite": 0,
"maxdisk": 32212254720,
"maxmem": 4294967296,
"mem": 2906828532,
"name": "traioi-test",
"netin": 140834582,
"netout": 889222,
"pid": 2812130,
"serial": 1,
"status": "running",
"uptime": 4901,
"vmid": 60227 --> Biến @vmid
}
],
"success": true
}
curl -X GET https://api.clients.vndata.vn/api/services/@service_id/vms/@vmid/ -u "<user_email>:<user_pass>" -H "Content-Type: application/json"
{
"message": {
"cpu": 0,
"cpus": 2,
"disk": 0,
"diskread": 0,
"diskwrite": 0,
"maxdisk": 32212254720,
"maxmem": 4294967296,
"mem": 2907001821,
"name": "traioi-test",
"netin": 140966111,
"netout": 889354,
"pid": 2812130,
"serial": 1,
"status": "running",
"uptime": 5008,
"vmid": 60227
},
"success": true
}
curl -X POST https://api.clients.vndata.vn/api/services/@service_id/vms/@vmid/stop/ -u "<user_email>:<user_pass>" -H "Content-Type: application/json"
{
"message": "Stop VM successful",
"success": true
}
curl -X POST https://api.clients.vndata.vn/api/services/@service_id/vms/@vmid/start/ -u "<user_email>:<user_pass>" -H "Content-Type: application/json"
{
"message": "Start VM successful",
"success": true
}
Trong bài viết này là cách hướng dẫn mọi người có thể quản lý dịch vụ, VPS của mình thông qua API