Ordering New Services

Index

Listing of available services:

Validating services and loading prices:

Ordering a new service:

Credit card, internet banking and credit payments:

List of available services

Every item has its name and a list of prices. The price is identified by an identifier/plan name (string), for example domain TLD. Currency is based on market identifier. WebSupport is currently on Slovak (sk), Czech (cz), Hungarian (hu) and Austrian (at) market.

URL parameters:

Curl

curl "https://rest.websupport.sk/v1/order/:market" -v

Request

GET https://rest.websupport.sk/v1/order/:market HTTP/1.1

Accept: application/json

Response 200

[
    {
        "type": "domain",
        "prices": [
            {
               "tld": "sk",
               "price": 12.3
            },
            {
               "tld": "eu",
               "price": 9.95
            },
            {
               "tld": "cz",
               "price": 10.95
            },
            {
               "tld": "com",
               "price": 9.95
            },
            {
               "tld": "co",
               "price": 29.95
            },
            {
               "tld": "net",
               "price": 9.95
            },
            {
               "tld": "info",
               "price": 9.95
            },
            {
               "tld": "biz",
               "price": 9.95
            }
            // and other supported domains
        ],
        "discounts": [
            {
               "tld": "eu",
               "price": 1
            }
        ],
        "currency": "eur"
    },
    {
        "type": "thehosting",
        "prices": [
            {
               "limit": 1024,
               "price": 1.4
            },
            {
               "limit": 3072,
               "price": 2.4
            },
            {
               "limit": 15360,
               "price": 4.8
            },
            {
               "limit": 51200,
               "price": 9.9
            }
        ],
        "discounts": [
        ],
        "currency": "eur"
    },
    {
        "type": "credit",
        "prices": [],
        "discounts": [],
        "currency": "eur"
    },
    {
       "type": "vps",
       "prices":
       [
           {
               "ram": 512,
               "disk": 15,
               "vcpus": 1,
               "price": 13
           },
           {
               "ram": 1024,
               "disk": 25,
               "vcpus": 2,
               "price": 20
           },
           {
               "ram": 2048,
               "disk": 50,
               "vcpus": 2,
               "price": 35
           },
           {
               "ram": 4096,
               "disk": 100,
               "vcpus": 4,
               "price": 57
           }
       ],
       "discounts":
       [
       ],
       "currency": "eur",
       "templates":
       [
           {
               "name": "ubuntu 12.04 minimal",
               "version": "1.1"
           },
           {
               "name": "ubuntu 12.04 webadmin",
               "version": "1.1"
           },
           {
               "name": "ubuntu 12.04 LAMP",
               "version": "1.1"
           }
       ]
   }
]

Response 404 (not found)

{
    "message": "Unknown market!",
    "code": 404
}

Service details

URL parameters:

Curl

curl "https://rest.websupport.sk/v1/order/:market/:type" -v

Request

GET https://rest.websupport.sk/v1/order/:market/:type HTTP/1.1

Accept: application/json

Response 200

{
    "type": "thehosting",
    "prices": [
        {
           "limit": 1024,
           "price": 1.4
        },
        {
           "limit": 3072,
           "price": 2.4
        },
        {
           "limit": 15360,
           "price": 4.8
        },
        {
           "limit": 51200,
           "price": 9.9
        }
    ],
    "currency": "eur"
}

Response 404 (not found)

{
    "message": "Unknown order type!",
    "code": 404
}

Validate a domain

This method is responsible for validating order attributes. The same attributes are used for real ordering. You can use this method as domain name validator, for checking domain availibility and for getting service prices.

Input fields:

Name Type Supported TLDs Required Comment
domain string all yes the full domain name with TLD, i.e. scaledo.com
dnsServers string sk, cz, eu no list of DNS servers separated by semicolon (;), ex. ns1.websupport.sk;ns2.websupport.sk
domainProfileId int all no id of domain profile, see Domain profiles
contactId string all no custom contact id

Method may throw 500 error response if something is wrong.

Curl

curl "https://rest.websupport.sk/v1/order/:market/validate/domain" -H "Content-Type: application/json" \
 -X POST -d '{"domain":"testingdomain.sk"}'

Request

POST https://rest.websupport.sk/v1/order/:market/validate/domain HTTP/1.1

Accept: application/json
Content-Type: application/json

{
  "domain":"testingdomain.sk"
}

Response 200 (ok)

{
    "status": "success",
    "item":
    {
        "domain": "testingdomain.sk",
        "suggest": true,
        "dnsServers": "",
        "contactId": "",
        "domainProfileId": 155,
        "price": 12.3,
        "priceWithVat": 14.76,
        "currency": "eur",
        "period": 1,
        "periodLength": "year"
    },
    "errors":
    [
    ]
}

Response 200 (validation failed)

{
    "status": "error",
    "item":
    {
        "domain": "aaa.com",
        "suggest": true,
        "price": null,
        "priceWithVat": null,
        "currency": null,
        "period": null,
        "periodLength": null
    },
    "errors":
    {
        "domain":
        [
            "Domain is taken."
        ]
    }
}

Validate The Hosting service

This method is responsible for validating order attributes. The same attributes are used for real ordering. You can use this method for getting service price.

Input fields:

Name Type Required Comment
limit int yes hosting limit in MB, range 1024~256000 (1 - 250 GB)
period int no service billing period in months, range 1~12, default is 1

Method may throw 500 error response if something is wrong.

Curl

curl "https://rest.websupport.sk/v1/order/:market/validate/thehosting" -H "Content-Type: application/json" \
 -X POST -d '{"limit":1024}'

Request

POST https://rest.websupport.sk/v1/order/:market/validate/thehosting HTTP/1.1

Accept: application/json
Content-Type: application/json

{
  "limit":1024
}

Response 200 (ok)

{
    "status": "success",
    "item":
    {
        "limit": 1024,
        "price": 1.4,
        "priceWithVat": 1.68,
        "currency": "eur",
        "period": 1,
        "periodLength": "month"
    },
    "errors": {}
}

Response 200 (validation failed)

{
    "status": "error",
    "item":
    {
        "limit": 1023,
        "price": null,
        "priceWithVat": null,
        "currency": null,
        "period": null,
        "periodLength": null
    },
    "errors":
    {
        "limit":
        [
            "Limit is too small (minimum is 1024)."
        ]
    }
}

Validate credit

This method is responsible for validating order attributes. The same attributes are used for real ordering. You can use this method for getting service price.

Input fields:

Name Type Required Comment
amount int yes amount to order, 1 credit is 1 EUR, HUF or CZK (depending on market)

Curl

curl "https://rest.websupport.sk/v1/order/:market/validate/credit" -H "Content-Type: application/json" \
 -X POST -d '{"amount":20}'

Request

POST https://rest.websupport.sk/v1/order/:market/validate/credit HTTP/1.1

Accept: application/json
Content-Type: application/json

{
  "amount":20
}

Response 200 (ok)

{
    "status": "success",
    "item":
    {
        "amount": 10,
        "price": 10,
        "price": 12,
        "currency": "eur",
        "period": null,
        "periodLength": null
    },
    "errors": {}
}

Response 200 (validation error)

{
   "status": "error",
   "item":
   {
        "amount": 0,
        "price": null,
        "priceWithVat": null,
        "currency": null,
        "period": null,
        "periodLength": null
   },
   "errors":
   {
       "amount":
       [
           "Amount is too small (minimum is 5)."
       ]
   }
}

Validate VPS

This method is responsible for validating order attributes. The same attributes are used for real ordering. You can use this method for getting service price.

Input fields:

Name Type Required Comment
name string yes vps hostname - only alphanumeric chars
ram int yes ram size in MB
disk int yes hdd size in GB
vcpus int yes number of virtual CPUs
templateName string yes template name, list of all templates is in Service details
templateVersion string yes version
period int no service billing period in months, range 1~12, default is 1
secondaryIp bool no default false
backups bool no default true

Curl

curl "https://rest.websupport.sk/v1/order/:market/validate/vps" -H "Content-Type: application/json" \
 -X POST -d '{"name":"test","ram":1024, "disk":10, "vcpus":1, "templateName":"ubuntu-12.04", "templateVersion":"v1", "period": 1}'

Request

POST https://rest.websupport.sk/v1/order/:market/validate/vps HTTP/1.1

Accept: application/json
Content-Type: application/json

{
    "name":"test",
    "ram":1024,
    "disk":10,
    "vcpus":1,
    "templateName":"ubuntu 12.04 webadmin",
    "templateVersion":"1.1",
    "period": 1
}

Response 200 (ok)

{
  "status": "success",
  "item": {
    "name": "test",
    "ram": 1024,
    "disk": 10,
    "vcpus": 1,
    "templateName": "ubuntu 12.04 webadmin",
    "templateVersion": "1.1",
    "backups": true,
    "secondaryIp": true,
    "price": 39.37,
    "priceWithVat": 47.24,
    "currency": "eur",
    "period": 1,
    "periodLength": "month",
    "priceDetail": {
        "prices": {
            "vps": 24.97,
            "serverManager": 5,
            "backups": 8.4,
            "secondaryIp": 1
        },
        "pricesWithVat": {
            "vps": 29.96,
            "serverManager": 6,
            "backups": 10.08,
            "secondaryIp": 1.2
        }
    }
  },
  "errors": {}
}

Response 200 (validation error)

{
   "status": "error",
   "item":
   {
        "name": "test",
        "ram": 1,
        "disk": 10,
        "vcpus": null,
        "templateName": "ubuntu 12.04 webadmin",
        "templateVersion": "1.1",
        "backups": true,
        "secondaryIp": true,
        "price": 9.2,
        "priceWithVat": null,
        "currency": null,
        "period": null,
        "periodLength": null
   },
   "errors":
   {
       "vcpus":
       [
           "Vcpus cannot be blank."
       ],
       "name":
       [
           "Virual server name is already taken."
       ],
       "ram":
       [
           "Ram is too small (minimum is 512)."
       ]
   }
}

Validating multiple services

Method for validating multiple services is identical to methods validating each service separately except for these two differences:

Response is also a list of responses used in validations. There is not a common status code, each services is validated separately.

Curl

curl "https://rest.websupport.sk/v1/order/:market/validate" -H "Content-Type: application/json" \
 -X POST -d '[{"type":"domain", "domain":"testingdomain.sk"}, {"type":"thehosting", "limit": 1024}]'

Request

POST https://rest.websupport.sk/v1/order/:market/validate HTTP/1.1

Accept: application/json
Content-Type: application/json

[
    {
        "type": "domain",
        "domain":"testingdomain.sk"
    },
    {
        "type": "thehosting",
        "limit": 1024
    }
}

Response 200 (ok)

[
    {
        "status": "success",
        "item":
        {
            "domain": "testingdomain.sk",
            "dnsServers": "",
            "sknicHandle": "WEBS-0001",
            "price": 12.3,
            "priceWithVat": 14.76,
            "currency": "eur",
            "period": 1,
            "periodLength": "year"
        },
        "errors":
        [
        ]
    },
    {
        "status": "success",
        "item":
        {
            "limit": 1024,
            "price": 1.4,
            "priceWithVat": 1.68,
            "currency": "eur",
            "period": 1,
            "periodLength": "month"
        },
        "errors": {}
    }
]

Ordering services

Input fields:

Name Type Required Comment
services list yes list of services to order
note string no additional information for our helpdesk team

Please refer to validate a domain and validate The Hosting service for service format.

Curl

curl "https://rest.websupport.sk/v1/user/:id/order" -H "Content-Type: application/json" \
 -X POST -d '[{"type":"domain", "domain":"testingdomain.sk"}, {"type":"thehosting", "limit": 1024}]' -u key:secret

Request

POST https://rest.websupport.sk/v1/user/:id/order HTTP/1.1

Accept: application/json
Content-Type: application/json

{
    "services": [
        {
            "type": "domain",
            "domain":"testingdomain.sk"
        },
        {
            "type": "thehosting",
            "limit": 1024
        }
    ],
    "note":"note to our helpdesk team"
}

Response 201 (ok)

{
    "status": "success",
    "item":
    {
        "id": 384718,
        "services":
        [
            {
               "status": "success",
               "item":
               {
                   "domain": "testingdomain.sk",
                   "dnsServers": "",
                   "sknicHandle": "WEBS-0001",
                   "price": 12.3,
                   "priceWithVat": 14.76,
                   "currency": "eur",
                   "period": 1,
                   "periodLength": "year"
               },
               "errors":
               [
               ]
            },
            {
                "status": "success",
                "item":
                {
                    "limit": 1234,
                    "price": 1.5,
                    "priceWithVat": 1.8,
                    "currency": "eur",
                    "period": 1,
                    "periodLength": "month"
                },
                "errors":
                [
                ]
            }
        ],
        "note": "note to our helpdesk team"
    },
    "errors":
    [
    ]
}

Response 200 (validation error)

{
    "status": "error",
    "item":
    {
        "id": null,
        "services":
        [
            {
                "status": "error",
                "item":
                {
                    "domain": "aaa.sk",
                    "dnsServers": "",
                    "sknicHandle": "WEBS-0001",
                    "price": 12.3,
                    "priceWithVat": 14.76,
                    "currency": "eur",
                    "period": 1,
                    "periodLength": "year"
                },
                "errors":
                {
                    "domain":
                    [
                        "Domain is taken."
                    ]
                }
            },
            {
                "status": "error",
                "item":
                {
                    "limit": 1,
                    "price": null,
                    "priceWithVat": null,
                    "currency": null,
                    "period": null,
                    "periodLength": null
                },
                "errors":
                {
                    "limit":
                    [
                        "Limit is too small (minimum is 1024)."
                    ]
                }
            }
        ],
        "note": "note to our helpdesk team"
    },
    "errors":
    {
        "services":
        [
            "There are invalid services in your order!"
        ]
    }
}

Response 200 (input format error)

{
    "status": "error",
    "item":
    {
        "id": null,
        "services": [],
        "note": ""
    },
    "errors":
    {
        "services":
        [
            "Service type at position 1 is not set!"
        ]
    }
}

Response 500 (something went wrong)

{
    "message": "Text of error message",
    "code": 500
}

Ordering with custom billing profile

If you want to create order with custom billing information use URL:

https://rest.websupport.sk/v1/user/:id/billing/:billingId/order

Testing order or running validation only

Just add parameter ?dryRun=1 to the end of the URL. Response format will be the same and return code will be 200 not 201.

Pay it

You can pay your order with credit card or using internet banking. At this moment we support TatraPay, VUB ePayments internet banking ComfortPay recurring payment system and Visa or MasterCard credit cards.

Payment URLs from this method are available few seconds after creating your order (usually up to 5s), but there can be problems with automatic order confirmation (for ex. your order contains note, so our helpdesk team needs to check it first). These orders are reviewed manually and confirmation can take hours. If you don't get response after 60s, ignore this method and wait for an e-mail with attached invoice.

Add ?mobile=1 at the end of each url, if you want mobile version of internet banking / credit card payment page.

Note: if you choose ComfortPay payment system, we will store your payment card so you can use it next time through pay with a stored card method. If you don't want to store your payment card, please use CardPay system (tbcardpay).

Curl

curl "https://rest.websupport.sk/v1/user/:userId/order/:orderId/pay" -u key:secret

Request

GET https://rest.websupport.sk/v1/user/:userId/order/:orderId/pay HTTP/1.1

Accept: application/json

Response 200

{
    "tbtatrapay": "https://admin.websupport.sk/sk/invoice/pay/invoiceId/109430586/type/tatrapay",
    "tbcardpay": "https://admin.websupport.sk/sk/invoice/pay/invoiceId/109430586/type/creditCard-0",
    "vubeplatby": "https://admin.websupport.sk/sk/invoice/pay/invoiceId/109430586/type/vubeplatby",
    "comfortpay": "https://admin.websupport.sk/sk/invoice/pay/invoiceId/109430586/type/creditCard-0"
}

Response 404 (order not found, not confirmed or already paid)

{
    "code": 404,
    "message": "Order is not confirmed."
}

Pay with a stored card

You can pay your order with payment card that you have assigned to your account in the past. List of available payment cards for logged user can be fetched with /v1/user/:userId/paymentcard api method.

Payment for order is available few minutes after creating your order (usually up to 5m), but there can be problems with automatic order confirmation (for ex. your order contains note, so our helpdesk team needs to check it first). These orders are reviewed manually and confirmation can take hours. If you don't get response after 60s, ignore this method and wait for an e-mail with attached invoice.

Curl

curl "https://rest.websupport.sk/v1/user/:userId/order/:orderId/pay/byPaymentCard/:paymentCardId" -u key:secret -X PUT

Request

PUT https://rest.websupport.sk/v1/user/:userId/order/:orderId/pay/byPaymentCard/:paymentCardId HTTP/1.1

Accept: application/json

Response 200

{
    "status": true
}

Response 404 (order not found, not confirmed or already paid)

{
    "code": 404,
    "message": "Order is not confirmed."
}

Pay with credit

Curl

curl "https://rest.websupport.sk/v1/user/:userId/order/:orderId/pay/byCredit" -u key:secret -X PUT

Request

PUT https://rest.websupport.sk/v1/user/:userId/order/:orderId/pay/byCredit HTTP/1.1

Accept: application/json

Response 200

{
    "status": true
}

Response 404 (order not found, not confirmed or already paid)

{
    "code": 404,
    "message": "Order is not confirmed."
}

List of all payment cards

Method for listing all payment cards of logged user.

Curl

curl "https://rest.websupport.sk/v1/user/:userId/paymentcard" -v -u key:secret

Request

GET https://rest.websupport.sk/v1/user/:userId/paymentcard HTTP/1.1

Accept: application/json

Response 200

{
   "items":
   [
       {
           "id": 123,
           "name": "4461********1234",
           "defaultBillingId": 1234,
           "createTime": 1279829310
       },
       {
           "id": 234,
           "name": "4406********9876",
           "defaultBillingId": 2345,
           "createTime": 1407915581
       }
   ],
   "credit": 0
}

Get a payment card detail

You can get info by payment card ID.

Curl

curl "https://rest.websupport.sk/v1/user/:userId/paymentcard/:id" -v -u key:secret

Request

GET https://rest.websupport.sk/v1/user/:userId/paymentcard/:id HTTP/1.1

Accept: application/json

Response 200

{
   "id": 234,
   "name": "4406********9876",
   "defaultBillingId": 2345,
   "createTime": 1407915581
}

Response 404 (not found)

{
    "message": "Payment card not found.",
    "code": 404
}

Add payment card

To add new payment card, you need to pay your first inovoice/order with ComfortPay system. More in pay it section.

Your card will be automatically added to your account and you can pay with pay with a stored card method.

raw