Set Zone State

This API method sets the zone state as either enabled or disabled. An enabled zone handles DNS requests while a disabled zone doesn’t respond to queries.

Request

PUT /zone/zone_name/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
  • 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:
PUT /zone/mydomain.com/disable 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 PUT -H "Accept: application/json" -H "Content-Length: 0" -k https://api.gslb.me/zone/mydomain.com/disable

Response

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

{"message":"Done","returncode":"0"}
  • 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 invalid zone:
HTTP/1.1 404 Not Found
Content-Type: application/json
{"message":"Zone not found","returncode":"2"}
  • 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"}