Accounts-accountNumber-web-domainName-subdomains:POST
From Hostway API Documentation
Revision as of 07:51, 20 April 2015 by Velimira.metodieva (Talk)
POST /accounts/{accountNumber}/web/{domainName}/subdomains
Creates subdomain.
Contents |
Request
POST /accounts/{accountNumber}/web/{domainName}/subdomains
URI Parameters
- accountNumber - string
- The user account to which the domain name and the subdomain belong
- domainName - string
- The target domain name (domain name under which the site is actually hosted)
Request Headers
- Authorization - HTTP Authorization header [1]
- The Authentication credentials of the client application.
Request Body
{ "subdomain": "{subdomain}" }
Parameters
- subdomain - string
- A valid subdomain. Required.
Response
Status Code
- 202 Accepted
- Success
- 400 Bad Request
- The format of the request body is invalid or the subdomain does not meet the requirements.
- 401 Unauthorized
- The supplied credentials are invalid or do not provide permissions for this operation.
- 404 Not Found
- The domain name does not exist.
- 409 Conflict
- The sub domain already exists(on create) or domain is disabled(on update).
Examples
Failure creating a subdomain when required parameter is missing
Request
POST /accounts/test-account/email/test.com/subdomains {"subdomain": ""}
Response
400 Bad Request {"badRequest": {"guid": "", "message": "POST data error", "code": 400, "details": {"subdomain": "Required"}}}
Failure creating a subdomain when passing invalid parameter
Request
POST /accounts/test-account/email/test.com/subdomains {"subdomain": "subtest4-subtest4-subtest4-subtest4-subtest4-subtest4-subtest4ab"}
Response
400 Bad Request {"badRequest": {"guid": "", "message": "POST data error", "code": 400, "details": {"subdomain": "Invalid subdomain name: subtest4-subtest4-subtest4-subtest4-subtest4-subtest4-subtest4ab"}}}
Successfully creating a subdomain
Request
POST /accounts/test-account/email/test.com/subdomains {"subdomain": "sub"}
Response
202 Accepted { "links": [{"href": "https://api.hostway.com/accounts/test-account/web/test.dom/subdomains/", "rel": "self"}, {"href": "https://api.hostway.com/orders/123/action/", "rel": "submit"}, {"href": "https://api.hostway.com/orders/123/quote/", "rel": "quote"}] }
Request
POST /orders/123/action {"action": "submit"}
Response
202 Accepted