Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:dedicated-server:tutorials:api:order-dedibox-from-api [2019/07/02 17:06]
dedibox [Dedibox Order API Overview]
en:dedicated-server:tutorials:api:order-dedibox-from-api [2019/07/24 09:46] (current)
dedibox
Line 11: Line 11:
   * You have [[https://​curl.haxx.se/​|curl]] installed on your local computer.   * You have [[https://​curl.haxx.se/​|curl]] installed on your local computer.
 </​note>​ </​note>​
- 
- 
  
 ==== Getting the Product ID ==== ==== Getting the Product ID ====
Line 113: Line 111:
 |rsync|Backup via Rsync options.| |rsync|Backup via Rsync options.|
 |addons|Addons list and categories (USB or HDD).| |addons|Addons list and categories (USB or HDD).|
-|category_quotas|Defines the addons quota per category (usb/hdd).|In the previous example, for the Start-2-XS-SATA it would be possible to order a maximum of 5 hdd and 1 usb drive.|+|category_quotas|Defines the addons quota per category (usb|hdd). 
 + 
 +In the previous example, for the Start-2-XS-SATA it would be possible to order at most 5 hdd and 1 usb drive.|
  
  
Line 181: Line 181:
 |addons|912 = USB drive of 500 GB / 1031 = HDD of 8 TB| |addons|912 = USB drive of 500 GB / 1031 = HDD of 8 TB|
  
-**Useful Links**+==== Terminating a server from the API ==== 
  
-Swagger: https://​console.online.net/​en/​api/​ +To terminate ​a server, ​send a `DELETE` request to the `/api/v1/server/<server id>` endpointReplace ​the `<server id>` prat with the ID of the server you want to terminate.
- +
-Get your private token: https://​console.online.net/​en/​api/​access +
- +
-==== Getting the Product ID ==== +
- +
-The first question you ask yourself when ordering ​dedicated ​server ​is: Which server do I want? +
- +
-For this reasonwe provide you an endpoint ''​/api/v1/dedibox/plans''​. +
- +
-This endpoint also returns miscellaneous information such as the price, technical specifications as well as the available stock in the datacenters.+
  
 <​code>​ <​code>​
-$ # Replace $OAUTH_ACCESS_TOKEN with your personal token +$ curl -s -X DELETE ​-H "​Authorization:​ Bearer $OAUTH_ACCESS_TOKEN"​ https://​api.online.net/​api/​v1/​server/123
-$ curl -s -H "​Authorization:​ Bearer $OAUTH_ACCESS_TOKEN"​ https://​api.online.net/​api/​v1/​dedibox/plans +
-+
-    "Start Range":​ { +
-        "​Start-2-XS-SATA":​ { +
-            "​id":​ 4445, +
-            "​price":​ "​7.99",​ +
-            "​specs":​ { +
-                "​cpu":​ "​Intel® C2350 (Avoton)",​ +
-                "​ram":​ "4 GB", +
-                "​disks":​ "1 x 500 GB", +
-                "​bp":​ "​1Gbit/​sec",​ +
-                "​policer_rate":​ "1 Gbit/​sec",​ +
-                "​customizable":​ false +
-            }, +
-            "​stocks":​ [ +
-                { +
-                    "​datacenter":​ { +
-                        "​id":​ 2, +
-                        "​name":​ "​DC2",​ +
-                        "​address":​ "29 rue Edith Cavell",​ +
-                        "​zip":​ "​94400",​ +
-                        "​city":​ "​Vitry",​ +
-                        "​country":​ "​FR"​ +
-                    }, +
-                    "​stock":​ 12 +
-            ], +
-            "​slug":​ "​Start-2-XS-SATA"​ +
-        }, +
-    ... +
-}+
 </​code>​ </​code>​
  
-To order a Start-2-XS-SATA from the Start commercial range, take a note of the ID **4445**.+To get your server IDs you have multiple choices:
  
-Obviously, if the stock of datacenter is equal to 0, it will not be possible to order this product in this location.+  * Get them directly from the server listing (ID column) 
 +  * Send `GET` request ​to the `/​api/​v1/​server` endpoint
  
-==== Getting Available Options and Add-ons ==== 
- 
-<note tip>This step is optional. If you do not wish options nor addons you can go right away to the next step.</​note>​ 
- 
-To view the available options and add-ons, can call the following endpoint: ''/​api/​v1/​dedibox/​options/<​product id>?​support=<​support level>''​ 
- 
-Replace ''<​product id>''​ with the ID of the offer Start-2-XS-SATA (e.g. **4445**) and ''<​support level>''​ with the support level you desire (''​basic''​ or ''​business''​). 
- 
-<​code>​ 
-$ curl -s -H "​Authorization:​ Bearer $OAUTH_ACCESS_TOKEN"​ https://​api.online.net/​api/​v1/​dedibox/​options/​4445?​support=basic 
-{ 
-    "​ftp":​ [ 
-        { 
-            "​id":​ 890, 
-            "​description":​ "​Backup 100GB",​ 
-            "​price":​ "​0",​ 
-            ... 
-        }, 
-        ... 
-    ], 
-    "​storage":​ [...], 
-    "​antidos":​ [...], 
-    "​network":​ [...], 
-    "​rsync":​ [...], 
-    "​addons":​ [ 
-        { 
-            "​product":​ { 
-                "​id":​ 912, 
-                "​description":​ "USB drive 500 GB", 
-                "​price":​ "​35",​ 
-                ... 
-            }, 
-            "​category":​ "​usb",​ 
-        }, 
-        ... 
-    ], 
-    "​category_quotas":​ { 
-        "​hdd":​ 5, 
-        "​usb":​ 1 
-    } 
-} 
-</​code>​ 
- 
-The table below describes the response returned by the API. 
- 
- 
-|Key|Description| 
-|ftp|Backup via ftp options.| 
-|storage|Storage (SAN) options.| 
-|antidos|AntiDoS protection options.| 
-|network|Network related options.| 
-|rsync|Backup via Rsync options.| 
-|addons|Addons list and categories (USB or HDD).| 
-|category_quotas|Defines the addons quota per category (usb|hdd). 
- 
-In the previous example, for the Start-2-XS-SATA it would be possible to order at most 5 hdd and 1 usb drive.| 
- 
- 
-==== Ordering Example ==== 
- 
-If you do not want to order any options, you still have to fill in 3 parameters: 
- 
-''​product'':​ ID of the product 
-''​datacenter'':​ ID of the desired datacenter or "​any"​ to let the API choose automatically 
-''​support'':​ ''​basic''​ for basic support, ''​business''​ for advanced support 
- 
-<​code>​ 
-$ curl -s -X POST -H "​Content-Type:​ application/​json"​ -H "​Authorization:​ Bearer $OAUTH_ACCESS_TOKEN"​ -d '​{"​product":​ 4445, "​datacenter":​ "​any",​ "​support":​ "​basic"​}'​ https://​api.online.net/​api/​v1/​dedibox/​ 
-{ 
-    "​id":​ 4946383 
-} 
-</​code>​ 
- 
-The API returns an order ID which can be used to know whether or not your server was provisionned and when. 
- 
-<​code>​ 
-$ curl -s  -H "​Authorization:​ Bearer $OAUTH_ACCESS_TOKEN"​ https://​api.online.net/​api/​v1/​dedibox/​status/​4946383 
-{ 
-    "​delivered":​ false 
-} 
-</​code>​ 
- 
-<note tip>If the network key is not provided, and the only option available is RPN-E, it is automatically included in your order at no charge. 
-In all other cases, we won't include any services by default.</​note>​ 
- 
-==== Ordering with Addons and Options ==== 
- 
-Following is a complete example showing how to order a server with options and addons (USB and HDD). 
- 
-<​code>​ 
-$ curl -s -X POST -H "​Content-Type:​ application/​json"​ -H "​Authorization:​ Bearer $OAUTH_ACCESS_TOKEN"​ -d '{ 
-    "​product":​ 4369, 
-    "​datacenter":​ "​any",​ 
-    "​support":​ "​business",​ 
-    "​ftp":​ 890, 
-    "​storage":​ 3625, 
-    "​antidos":​ 776, 
-    "​network":​ 3485, 
-    "​rsync":​ 765, 
-    "​addons":​ { 
-        "​912":​ { "​quantity":​ 1 }, 
-        "​1031":​ { "​quantity":​ 2 } 
-    } 
-}' https://​api.online.net/​api/​v1/​dedibox/​ 
-{ 
-    "​id":​ 3492932 
-} 
-</​code>​ 
- 
- 
-The table below explains what was ordered. 
- 
-|Key|Description| 
-|product|Pro-3-L-SSD| 
-|datacenter|Any datacenter available| 
-|support|business support| 
-|ftp|Backup FTP of 100 GB| 
-|storage|SAN storage of 1 TB (via RPN)| 
-|antidos|Curative antidos option| 
-|network|RPN G| 
-|rsync|RPN Rsync 500| 
-|addons|912 = USB drive of 500 GB / 1031 = HDD of 8 TB| 
  
-**Useful Links**+==== Useful Links ====
  
 Swagger: https://​console.online.net/​en/​api/​ Swagger: https://​console.online.net/​en/​api/​