Public GPU Servers API Reference
1. Authentication
Endpoint
https://api.leaderssl.com/api/v1/users/signin
Parameters
- login
- password
Method
POST
Return
Success
HTTP code 200, return value is an JSON-encoded object
{"id": 12345, "auth_token": "kZoG4GMyPzsl_Ei_nZFSqA"}
id - the user's ID, integer
auth_token - Authentication token
Error
Authentication failure
HTTP code 401, return value is an JSON-encoded object
{"error":"error description"}
Examples
curl -i -H "Accept: application/json" -X POST --data 'login=nosuchuser@example.org&password=j3Sk8nZwp29XpR' 'https://api.leaderssl.com/api/v1/users/signin' HTTP/1.1 401 Unauthorized {"error":"Invalid login or password"} curl -i -H "Accept: application/json" -X POST --data 'login=johndoe@test.com&password=somepassword' 'https://api.leaderssl.com/api/v1/users/signin' HTTP/1.1 200 OK {"id":1703,"auth_token":"BUYVWzx7df60ukU9px2-Dg"}
2. Products list and prices
Endpoint
https://api.leaderssl.com/api/v1/users/{user_id}/servers/products
Parameters
- user_id. User ID returned in signin call
- auth_token. Authorization token returned in signin call. Can be passed as X-AUTH-TOKEN HTTP header, or as auth_token HTTP query parameter.
Method
GET
Return
Success
HTTP code 200, JSON-encoded array of available for order GPU servers
[ { "code": "GPU:Nvidia:GTX1080:2:Minute", "currency": "EUR", "free_time": "2017-05-22T21:05:32+03:00", "id": 534, "name": "2 x GeForce GTX 1080 (per-minute billing)", "period_count": 1, "period_type": "minute", "price": "0.02" }, { "code": "GPU:Nvidia:GTX1080:2:Week", "currency": "EUR", "free_time": "2017-05-22T21:05:32+03:00", "id": 543, "name": "2 x GeForce GTX 1080 (weekly)", "period_count": 1, "period_type": "week", "price": "91.11" }, { "code": "GPU:Nvidia:GTX1080:4:Minute", "currency": "EUR", "free_time": null, "id": 535, "name": "4 x GeForce GTX 1080 (per-minute billing)", "period_count": 1, "period_type": "minute", "price": "0.03" }, ... ]
- "code":string Internal product code.
- "id":integer Product ID
- "name":string Product name
- "free_time":(null|Time) Time when a server with given configuration becomes available. null - the server is available at the moment of call
- "currency":String Currency code
- "period_type":String(minute|week|month) Billing period
- "period_count":Integer Billing period
- "price":String Product price
Error
http status 401
{"error":"error description"}
3. Order server
Endpoint
https://api.leaderssl.com/api/v1/servers/order
Parameters
- auth_token. Authorization token returned in signin call. Can be passed as X-AUTH-TOKEN HTTP header, or as auth_token HTTP query parameter.
- nomenclature_id. Product ID returned in products list call.
- os. OS Type. Can be one of the following: 'centos', 'windows', 'ubuntu'
- period_count. Order period.
Method
POST
Return
Success
HTTP code 200, JSON object with order ID and proforma invoice token.
{"order_id":1234,"bill":"aa6e2b2b7eb61ab6af081cc007fd80c87ff49fcb", "url":"https://order.leadertelecom.biz/payments/aa6e2b2b7eb61ab6af081cc007fd80c87ff49fcb"}
order_id:integer Order ID
bill:string Proforma invoice token
* url:string URL to pay the order online or download proforma invoice
Error
http status 401
{"error":["error description", "Another error description"]}
4. Ordered servers
Endpoint
https://api.leaderssl.com/api/v1/users/{user_id}/servers
Parameters
- user_id. User ID returned in signin call
- auth_token. Authorization token returned in signin call. Can be passed as X-AUTH-TOKEN HTTP header, or as auth_token HTTP query parameter.
Method
GET
Return
Success
HTTP code 200, JSON-encoded array of ordered GPU servers
[ { "id":228, "ip":"217.150.90.19", "name":"LTBV19", "config":"4 x GeForce GTX 1080TI (per-minute billing)", "start_at":"2017-05-28T22:24:34+03:00", "end_at":"2017-05-31T11:56:30+03:00", "valid_to":"2017-05-28T22:49:58+03:00", "status":"busy", "username":"root", "os_type":"centos", "token":"37e67a831cc95792a8a18dac90741053a4a9187b", "resume_available":false, "suspend_available":false, "uptime":221460 }, { "id":271, "ip":"Queued", "name":"Queued", "config":"2 x GeForce GTX 1080 (per-minute billing)", "start_at":null, "end_at":null, "valid_to":null, "status":"queued", "username":"root", "os_type":"centos", "token":"67b0a7586aa37604d42b16aeefc4daba7c62a057", "resume_available":false, "suspend_available":false, "uptime":0 }, { "id":14, "ip":"Queued", "name":"Queued", "config":"8 x GeForce GTX 1080 (per-minute billing)", "start_at":null, "end_at":null, "valid_to":null, "status":"available", "username":"Administrator", "os_type":"windows", "token":"1281a08eb13106647ac2de1d2cd5321a09cc904c", "resume_available":false, "suspend_available":false, "uptime":0 } ]
- "id":integer Server ID
- "ip":string ("Queued" | IPv4 Address) Server IP Address. For pool servers string "Queued".
- "name":string ("Queued" | Server Name) Internal server name. For pool servers string "Queued".
- "confif":string Server hardware configuration
- "start_at":(null | Time) Time when the server started. null if the server has not been started yet.
- "end_at":(null | Time) Time when the server was stopped. null if the server currently working.
- "valid_to":(null | Time) Paid period for the server.
- "status":string ("up"|"booting"|"busy"|"available"|"queued") Server status. UP - the server is up and running by the user. booting - the server is in boot process. available - the server is available for start or resume. queued - all servers in the pool are busy. busy - deirectly assigned server is occupied by another user.
- "username":string Default username (login) for selected OS
- "os_type":string Can be one of the following: 'centos', 'windows', 'ubuntu'
- "resume_available":boolean True if current server can be resumed
- "suspend_available":boolean True if current server can be suspended
- "uptime":integer Total time of all server sessions
Error
http status 401
{"error":"error description"}
5. Start server
Endpoint
https://api.leaderssl.com/api/v1/users/{user_id}/servers/{id}/start
Parameters
- user_id. User ID returned in signin call
- server_id. Server ID returned in servers call
- auth_token. Authorization token returned in signin call. Can be passed as X-AUTH-TOKEN HTTP header, or as auth_token HTTP query parameter.
Start server call available only if server's status id "available"
Method
POST
Return
Success
HTTP code 200, JSON-encoded object
{"success":true}
Error
{"success":"false"}
6. Stop server
Endpoint
https://api.leaderssl.com/api/v1/users/{user_id}/servers/{id}/stop
Parameters
- user_id. User ID returned in signin call
- server_id. Server ID returned in servers call
- auth_token. Authorization token returned in signin call. Can be passed as X-AUTH-TOKEN HTTP header, or as auth_token HTTP query parameter.
Stop server call available only if server's status id "up"
Method
POST
Return
Success
HTTP code 200, JSON-encoded object
{"success":true}
Error
{"success":"false"}
7. Suspend server
Endpoint
https://api.leaderssl.com/api/v1/users/{user_id}/servers/{id}/suspend
Parameters
- user_id. User ID returned in signin call
- server_id. Server ID returned in servers call
- auth_token. Authorization token returned in signin call. Can be passed as X-AUTH-TOKEN HTTP header, or as auth_token HTTP query parameter.
Stop server call available only if server's status id "up" and "suspend_available" is true.
Method
POST
Return
Success
HTTP code 200, JSON-encoded object
{"success":true}
Error
{"success":"false"}
8. Resume server
Endpoint
https://api.leaderssl.com/api/v1/users/{user_id}/servers/{id}/resume
Parameters
- user_id. User ID returned in signin call
- server_id. Server ID returned in servers call
- auth_token. Authorization token returned in signin call. Can be passed as X-AUTH-TOKEN HTTP header, or as auth_token HTTP query parameter.
Stop server call available only if server's status id "available" and "resume_available" is true.
Method
POST
Return
Success
HTTP code 200, JSON-encoded object
{"success":true}
Error
{"success":"false"}