This API method fetches a target configuration

Request

GET /target/geohost_name/target_name HTTP/1.0
Host: api.gslb.me 
Accept: encoding_type
Authorization: Basic base64_credentials

Where:

  • geohost_name is the name of the geohost the target belongs to (ie.: mygeohost.mydomain.com)
  • target_name is the name of the target you want to get configuration for (ie.: the IP address or FQDN of your target)
  • 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:
GET /target/mygeohost.mydomain.com/1.2.3.4 HTTP/1.0
Host: api.gslb.me 
Accept: application/json
Authorization: Basic dGVzdHVzZXJAZ3NsYi5tZTp0ZXN0cGFzc3dvcmQK
  • Using curl:
curl -X GET -u testuser@gslb.me:testpassword -H "Accept: application/json" https://api.gslb.me/target/mygeohost.mydomain.com/1.2.3.4

Response

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

{"message":"Geohost not found","returncode":"2"}
  • In case of invalid target:
HTTP/1.1 404 Not Found
Content-Type: application/json

{"message":"Target 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"}
  • In case of success:
HTTP/1.1 200 OK
Content-Type: application/json

{
  "target":
  {
    "active":"true",
    "address":"1.2.3.4",
    "alias":"target-1.domain.com",
    "checks":{
      "check":
      [
        {
          "active":"true",
          "name":"Ping check",
          "parameters":null,
          "reverse":"false",
          "timeout":"3",
          "typeTag":"check.icmp"
        },
        {
          "active":"true",
          "name":"HTTP GET / check",
          "parameters":
          {
            "parameter":
            [
              {"type":"check.http.port","value":"80"},
              {"type":"check.http.uri","value":"/"},
              {"type":"check.http.statuscode","value":"200"},
              {"type":"check.http.host","value":"myhttp.host.com"},
              {"type":"check.http.regexp","value":""},
              {"type":"check.http.username","value":""},
              {"type":"check.http.password","value":""},
              {"type":"check.http.authenabled","value":"false"}
            ]
          },
          "reverse":"false",
          "timeout":"30",
          "typeTag":"check.http"
        }
      ]
    },
    "geoHostName":"mygeohost",
    "geoHostZoneName":"mydomain.com",
    "priority":"1",
    "reqChecks":"2",
    "schedule":"15",
    "weight":"1"
  }
}

Where:

  • active: the state of the target
  • address: the IP address or FQDN of the target
  • alias: the (optional) IP address or FQDN alias for the target
  • checks: a group of check objects defining the healthchecks for the target
  • geoHostName: the name of the geohost. Together with the field “geoHostZoneName” it defines the DNS FQDN of the geohost. The FQDN of the geohost is “geoHostName.geoHostZoneName
  • geoHostZoneName: the name of the DNS zone this target’s geohost belongs to
  • priority: the target priority, only used if the geohost’s balancing algorithm is “priority”
  • reqChecks: the minimum number of “healthy” checks needed to mark the target as “healthy”
  • schedule: schedule interval in seconds to run all checks for the target
  • weight: the target “weight”, only used if the geohosts’s balancing algorithm is “weighted”