This API method adds a new record to a zone. After adding one or more records to a zone the Commit Zone API method must be called in order to make the change(s) active.

Here you can access the deprecated “Add Zone Record” API method.

Request

POST /record HTTP/1.0
Host: api.gslb.me 
Accept: encoding_type
Authorization: Basic base64_credentials
Content-Type: application/json

{    
  "zone": "zone.name.tld", 
  "records": [ 
    { 
      "name":"record.name", 
      "type":"recordtype", 
      "value":"recordvalue", 
      "ttl":"ttlvalue" 
    },
    ...
   {
     "name":"record.name",
     "type":"recordtype",
     "value":"recordvalue",
     "ttl":"ttlvalue"
    }
  ] 
}

Where:

  • zone.name.tld is the name of the zone you want to add a record to (ie.: mydomain.com)
  • record.name is the name of the record you want to create (ie.: www to create the FQDN www.mydomain.com)
  • recordtype is the type of the record you want to create (supported types are A, AAAA, ALIAS, CAA, CERT, CNAME, LOC, MX, NS, RP, SOA, SPF, SRV, TXT)
  • recordvalue is the value of the record you want to create. The record value must be coherent with the record_type (ie. MX records must be in the “xx FQDN” format where xx is the MX priority, all IPs must be public, etc)
  • ttlvalue is the record TTL in seconds, ranging from 30 to 86400
  • 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)

Sample requests:

  • Raw request:
POST /record HTTP/1.0
Host: api.gslb.me
Accept: application/json
Authorization: Basic dGVzdHVzZXJAZ3NsYi5tZTp0ZXN0cGFzc3dvcmQK
Content-Type: application/json

{
  "zone": "mydomain.com",
  "records": [
    {
      "name":"www",
      "type":"A",
      "value":"11.22.33.44",
      "ttl":"300"
    }
  ]
}

  • Using curl:
curl -u testuser@gslb.me:testpassword -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -k https://api.gslb.me/record -d '{
 "zone": "mydomain.com",
 "records": [
 {
 "name":"www",
 "type":"A",
 "value":"11.22.33.44",
 "ttl":"300"
 }
 ]
}'

Response

  • In case of invalid zone:
HTTP/1.1 404 Not Found
Content-Type: application/json

{"message":"Zone not found","returncode":"2"}
  • In case of inconsistent record type and value / if RFC1918 IPs are used:
{"message":"Inconsistent parameters, cannot create record","returncode":"3"}
  • If a free user is trying to create more than 20 records for the free zone:
{"message":"As a free user you can configure up to 20 records, upgrade your account to \"pro\" to use more","returncode":"5"}
  • 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"}
  • In case of success:
HTTP/1.1 200 OK
Content-Type: application/json

{"message":"Done","returncode":"0"}

Where:

  • message is set to “Done”
  • returncode is set to 0