Find the answers you need

Support Database

How do I provision a hosting package via the API?

POST /reseller/{id}/addWeb

The /reseller/{id}/addWeb endpoint permits the creation of hosting packages.

PHP examples use our API wrapper, which can be downloaded here: https://my.20i.com/reseller/api

PHP

Request:

<span class="hljs-meta">require_once “vendor/autoload.php”; //We specify the API wrapper location.<br /> $bearer_token = “INSERT YOUR GENERAL API KEY”; //Your 20i API key.<br /> $services_api = new \TwentyI\API\Services($bearer_token);<br /> $domain = “test20i.com”; //The primary domain we wish to assign to our new package.<br /> $addPackage = [“domain_name” => $domain, “type” => “811”]; //These are our supported arguments. For example, the name of the package we've just defined, and the package type we'd like to create the package as.<br /> $response = $services_api->postWithFields(”/reseller/*/addWeb”, $addPackage);</span>

Result:


{
    "result": 866239
}

The response will contain the ID of the newly created package.

Supported arguments

“type” string

A web type reference, equivalent to the id in /packageTypes

“domain_name”string

The initial domain name for the site

“extra_domain_names”string[]

Array of zero or more extra domain names

“label”string

The memorable name for the package

“documentRoots”object

A map of domain names to intended document roots

“stackUser”string|null

eg. “stack-user:1”. An existing Stack user to link to the package.