REST API – WEDOS.protection Domains

WEDOS REST API is still in development. Access and features may change without notice.

This article partially covers the WEDOS.protection endpoint of WEDOS REST API. WEDOS.protection services and Members have their own articles. For WEDOS API (WAPI) see WAPI – WEDOS Protection.

For basic information anbout WEDOS REST API, consult the WEDOS REST API Manual.

In this article, you will find the following information:


WGP Endpoint Access

The WGP HTTP REST API v2 is used to manage domains, services and co-management invitations in WEDOS.protection (WGP).

Base URL and Authentication

The base URL for the WGP endpoints is: https://api.wedos.com/v2

Authentication uses only OAuth2: include a valid access token in the request header (Authorization: Bearer <TOKEN>) with the wgp scope. Without a valid token the API returns error 2000.

You can add the parameter example=1 to any endpoint as a GET parameter (?example=1 for endpoints without their own GET parameters, otherwise &example=1). The API then returns a sample curl command for that call without requiring real parameters. Valid authentication is required even in this mode.

Endpoint Overview

MethodEndpointDescription
GET/domains/{domain}Detail of one domain in WGP
GET/domains/templatesList of template domains for a given service variant
POST/domains/createSet up a new domain in WGP
POST/domains/infoDetail of one or more domains in WGP
POST/domains/{domain}/create/retryRetry domain setup after an error
POST/domains/{domain}/delete-orderDelete an unfinished domain order

Response format

The API response is always a JSON object with the keys code (return code), msg (text description), request_id (request identifier) and, where applicable, data (returned data on success).

General return codes valid for all endpoints (REST layer, independent of the specific operation):

  • 1000 – success (OK)
  • 2000 – authentication (OAuth2 Bearer token) missing or invalid
  • 2004 – maximum request size exceeded (URL or request body)
  • 4000 – unknown/unsupported API method (the called combination of HTTP method and path does not exist)
  • 4001 – input validation failed
  • 4005 – no example available for the current endpoint in example=1 mode
  • 6000 – internal error initializing the underlying WAPI command

In addition, each endpoint returns its own business codes specific to the operation (corresponding to the underlying WAPI command). These are listed under Return codes for each endpoint.


GET /domains/{domain}

Returns information about one domain connected to WGP – a combination of data from the external WEDOS Global Protection administration and the internal WEDOS database.

Parameters:

  • domain – required, path – domain name

Return codes:

  • 1000 – OK
  • 2100 – required parameter missing
  • 2101 – invalid parameter format
  • 2202 – invalid or unsupported domain name format
  • 2292 – the domain does not exist in WGP for this customer account
  • 2400 – internal error – unregistered return code from the WGP API (see Notes)
  • 2418 – TXT record missing for a domain in the Pending_TXT state

Response data:

  • wgp – domain data from the external WGP administration (e.g. domain state, admin account flag and more; the items wedos_client_id and cms are removed from the response)
  • service – domain data from the internal database: ID, name, num, user_id, lang, currency, billing (cli_*) and owner (own_*) contact details, status, expiration

Example:

curl -X GET -H 'Authorization: Bearer <TOKEN>' \
  'https://api.wedos.com/v2/wgp/domains/domain1.tld'
{
  "code": 1000,
  "msg": "OK",
  "request_id": "a1b2c3d4",
  "data": {
    "wgp": {
      "domain": "domain1.tld",
      "state": "active",
      "user_admin": false
    },
    "service": {
      "ID": 435,
      "name": "domain1.tld",
      "num": "2026123456",
      "user_id": 10234,
      "lang": "cs",
      "currency": "CZK",
      "status": "active",
      "expiration": "2027-10-01 00:00:00"
    }
  }
}

GET /domains/templates

Returns a paged list of template domains available for the given WGP service variant. Use it as the source of template_domain_id when setting up a domain or replicating settings.

Parameters:

  • variant_id – required, query – WGP service variant ID (see the hosting_wedos_protection.variants code list)
  • per_page – optional, query – records per page; default 15, value -1 returns all records
  • page – optional, query – page number; default 1
  • locale – optional, query – paging language, allowed values cs, en; default en
  • search – optional, query – search string in the columns custom_name, name

Return codes:

  • 1000 – OK
  • 2100 – required parameter missing (variant_id)
  • 2400 – internal error – unregistered return code

Response data:

  • data – array of template domains; each item contains id, custom_name, name, url
  • per_page, total, last_page, from, to – paging details
  • first_page_url, prev_page_url, next_page_url, last_page_url, path – links to individual pages
  • links – array of paging elements (url, label, active)

Example:

curl -X GET -H 'Authorization: Bearer <TOKEN>' \
  'https://api.wedos.com/v2/wgp/domains/templates?variant_id=1'
{
  "code": 1000,
  "msg": "OK",
  "request_id": "a1b2c3d4",
  "data": {
    "data": [
      {
        "id": 123,
        "custom_name": "Sample e-shop",
        "name": "template-eshop.wedos.com",
        "url": "https://template-eshop.wedos.com"
      }
    ],
    "per_page": 15,
    "total": 1,
    "last_page": 1,
    "from": 1,
    "to": 1,
    "path": "https://api.wedos.com/v2/wgp/domains/templates",
    "first_page_url": "https://api.wedos.com/v2/wgp/domains/templates?page=1",
    "prev_page_url": null,
    "next_page_url": null,
    "last_page_url": "https://api.wedos.com/v2/wgp/domains/templates?page=1",
    "links": [
      {"url": null, "label": "&laquo; Previous", "active": false},
      {"url": "https://api.wedos.com/v2/wgp/domains/templates?page=1", "label": "1", "active": true},
      {"url": null, "label": "Next &raquo;", "active": false}
    ]
  }
}

POST /domains/info

Returns information about one or more domains in WGP (equivalent to GET /domains/{domain}, but you can give several comma-separated domains in the request body).

Parameters:

  • domain – required – domain name, or several names separated by commas (e.g. "domain1.tld,domain2.tld")

Return codes:

  • 1000 – OK
  • 2100 – required parameter missing
  • 2101 – invalid parameter format
  • 2202 – invalid or unsupported domain name format
  • 2292 – the domain does not exist in WGP for this customer account
  • 2400 – internal error – unregistered return code from the WGP API
  • 2418 – TXT record missing for a domain in the Pending_TXT state

Response data: For one domain, the same structure as GET /domains/{domain} (keys wgp and service). For several domains, the response is an object keyed by domain name, where each item again has the wgp and service structure.

Example:

curl -X POST -H 'Authorization: Bearer <TOKEN>' -H 'Content-Type: application/json' \
  'https://api.wedos.com/v2/wgp/domains/info' \
  --data '{"domain":"domain1.tld,domain2.tld"}'
{
  "code": 1000,
  "msg": "OK",
  "request_id": "a1b2c3d4",
  "data": {
    "domain1.tld": {
      "wgp": {"domain": "domain1.tld", "state": "active", "user_admin": false},
      "service": {"ID": 435, "name": "domain1.tld", "status": "active", "expiration": "2027-10-01 00:00:00"}
    },
    "domain2.tld": {
      "wgp": {"domain": "domain2.tld", "state": "active", "user_admin": false},
      "service": {"ID": 436, "name": "domain1.tld", "status": "active", "expiration": "2027-03-15 00:00:00"}
    }
  }
}

POST /domains/create

Sets up a new domain in WGP. It can also be used to restore a domain that was suspended (state disabled) because its setup was not completed in time after creation.

Parameters:

  • domain – required – domain name
  • variant_id – required, number – service variant ID (see the hosting_wedos_protection.variants code list)
  • period_id – required, number – subscription period ID
  • upstream_ips – optional, array – array of IP addresses that will not be resolved to WGP
  • template_domain_id – optional, number – ID of the template domain used to configure the new domain
  • mode – optional, string – domain mode, allowed values ns or cname

Return codes:

  • 1000 – OK (restoration of a previously suspended domain from the disabled state)
  • 1001 – request accepted, domain setup is being processed
  • 2101 – invalid parameter value
  • 2202 – invalid or unsupported domain name format
  • 2203 – invalid value of period_id
  • 2272 – invalid IP address format (upstream_ips)
  • 2273 – invalid value of variant_id
  • 2276 – unsupported TLD
  • 2277 – an explicit www. in the domain name is not allowed
  • 2278 – a service for this domain already exists
  • 2279 – the prepaid account is locked
  • 2281 – the prepaid account is not active
  • 2282 – cannot pay from the prepaid account in the given currency
  • 2283 – insufficient prepaid account balance
  • 2284 – error in the prepaid account’s contact details
  • 2285 – incorrect billing setting with/without VAT
  • 2291 – the domain already exists in WGP for this customer account
  • 2293 – cannot get the prepaid account credit balance
  • 2294 – cannot get the service price
  • 2416 – invalid domain mode (mode)
  • 2417 – invalid or unsupported subdomain name format
  • 2422 – cannot determine the account type (admin/customer)
  • 2423 – internal error calling the WGP API
  • other error codes specific to the operation (e.g. template domain replication validation 2401–2405)

Response data:

  • WGP_ID – domain ID in WGP
  • domain – domain name
  • order_num – order number (unless the domain is set up free of charge or by an admin account; also on restoration from the disabled state)
  • currency, amount – currency and amount deducted from the prepaid account
  • acc_amount_before, acc_amount_current – prepaid account balance before and after payment
  • desc – description (present only when restoring a domain from the disabled state)

Example:

curl -X POST -H 'Authorization: Bearer <TOKEN>' -H 'Content-Type: application/json' \
  'https://api.wedos.com/v2/wgp/domains/create' \
  --data '{"domain":"domain1.tld","variant_id":1,"period_id":1,"mode":"ns"}'
{
  "code": 1001,
  "msg": "Request pending",
  "request_id": "a1b2c3d4",
  "data": {
    "WGP_ID": 98765,
    "domain": "domain1.tld",
    "order_num": "2026123456",
    "currency": "CZK",
    "amount": -499,
    "acc_amount_before": 1500,
    "acc_amount_current": 1001
  }
}

POST /domains/{domain}/create/retry

Retries a domain setup that ended with an error (available only for certain domain states, e.g. error_crt).

Parameters:

  • domain – required, path – domain name

Return codes:

  • 1000 – OK
  • 2100 – required parameter missing
  • 2292 – the domain does not exist in WGP for this customer account
  • 2400 – internal error – unregistered return code

Response data:

  • domain – domain name
  • domain_id – domain ID in WGP
  • wedos_client_id – client ID in WGP

Example:

curl -X POST -H 'Authorization: Bearer <TOKEN>' \
  'https://api.wedos.com/v2/wgp/domains/domain1.tld/create/retry'
{
  "code": 1000,
  "msg": "OK",
  "request_id": "a1b2c3d4",
  "data": {
    "domain": "domain1.tld",
    "domain_id": 98765,
    "wedos_client_id": 10234
  }
}

POST /domains/{domain}/delete-order

Deletes an unfinished domain order – the state where the domain is stuck in WGP with no way to complete activation and the local service does not exist yet.

Parameters:

  • domain – required, path – domain name

Return codes:

  • 1000 – OK
  • 2100 – required parameter missing
  • 2292 – the domain was not found in WGP for this customer account
  • 2400 – internal error
  • 2410 – service not found
  • 2421 – the WGP service already exists, the domain will not be removed

Response data:

  • domain – domain name
  • domain_id – domain ID in WGP
  • wedos_client_id – client ID in WGP

Example:

curl -X POST -H 'Authorization: Bearer <TOKEN>' \
  'https://api.wedos.com/v2/wgp/domains/domain1.tld/delete-order'
{
  "code": 1000,
  "msg": "OK",
  "request_id": "a1b2c3d4",
  "data": {
    "domain": "domain1.tld",
    "domain_id": 98765,
    "wedos_client_id": 10234
  }
}

Was this helpful?

Thanks for your feedback!
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors