Create Zone

This API method creates a new zone. The user must be allowed enough available zones in order to successfully create a new one. Free users can create one zone.

Request

POST /zone/zone_name/contact_email/state HTTP/1.0
Host: api.gslb.me 
Accept: encoding_type
Content-Length: 0
Authorization: Basic base64_credentials

Where:

  • zone_name is the name of the zone you want to set
  • contact_email is the e-mail address of the zone contact person
  • state is the desired state as either “enable” or “disable” (without quotes)
  • base64_credentials is username:password in base64-encoded format (HTTP Basic Authentication)
  • encoding_type is either application/xml or application/json (if the “Accept” header is omitted, response will be JSON-encoded)

Note: The “Content-Length: 0” header is mandatory.

Sample requests:

  • Raw request:
POST /zone/mynewdomain.com/admin@myotherdomain.com/enable HTTP/1.0
Host: api.gslb.me 
Accept: application/json
Content-Length: 0
Authorization: Basic dGVzdHVzZXJAZ3NsYi5tZTp0ZXN0cGFzc3dvcmQK
  • Using curl:
curl -u testuser@gslb.me:testpassword -X POST -H "Accept: application/json" -H "Content-Length: 0" -k https://api.gslb.me/zone/newzone.com/admin@myotherdomain.com/enable

Response

  • In case of success:
HTTP/1.1 200 OK
Content-Type: application/json

{"message":"Done","returncode":"0"}
  • If the user is not allowed to create more zones (free users can create one zone)
HTTP/1.1 403 Forbidden
Content-Type: application/json

{"message":"You can configure up to 1 zones, upgrade your account to "pro" to use more","returncode":"5"}
  • If the new zone already exists
HTTP/1.1 403 Forbidden
Content-Type: application/json

{"message":"Zone already exists","returncode":"6"}
  • If the new zone name is invalid
HTTP/1.1 400 Bad Request
Content-Type: application/json

{"message":"Invalid zone name","returncode":"3"}
  • If the contact e-mail address is invalid
HTTP/1.1 400 Bad Request
Content-Type: application/json

{"message":"Invalid contact e-mail address","returncode":"3"}
  • If the desired state is neither “enable” nor “disable”:
HTTP/1.1 400 Bad Request
Content-Type: application/json

{"message":"Bad parameter: desired zone state must be either "enable" or "disable"","returncode":"3"}
  • In case of internal error:
HTTP/1.1 500 Server Error
Content-Type: application/json

{"message":"Internal error, please contact support@gslb.me","returncode":"4"}