Retrieve details about a location

Retrieve details about a location

GET api/locations/template_name

Retrieves the details about a location, specified by the template_name of the location.

The template_name for a location is the location name in all lowercase, replacing any spaces or special characters with hyphens, for example, a location named Location 1234 would have a template_name of location-1234. The location template_name is also in the response of the List all locations API. For more information, see List all locations.

Request syntax

get api/locations/<template_name>

Request parameters

The request accepts no parameters.

Response syntax

{
    "location_id": integer,
    "name": "string",
    "template_name": "string",
    "addressline1": "string",
    "addressline2": "string",
    "city": "string",
    "state": "string",
    "zipcode": "string",
    "country": "string",
    "updated_at": "timestamp",
    "nodes": [
        {
            "node_id": integer,
            "hostname": "string",
            "keepalive": "string",
            "keepalive_timestamp": integer,
            "last_online": "string",
            "hardware_type": "string",
            "updated_at": "timestamp"
        },
        {
            "node_id": integer,
            "hostname": "string",
            "keepalive": "string",
            "keepalive_timestamp": integer,
            "last_online": "string",
            "hardware_type": "string",
            "updated_at": "timestamp"
        }
    ]
}

Response parameters

If the action is successful, an HTTP 200 response is returned. The following data is returned in JSON format.

FieldTypeDescription
location_idIntegerThe ID of the location.
nameStringThe name of the location.
template_nameStringThe template name associated with the location.
addressline1StringThe first line of the physical address of the location.
addressline2StringThe second line of the physical address of the location.
cityStringThe city associated with the physical address of the location.
stateStringThe state associated with the physical address of the location.
zipcodeStringThe zip code associated with the physical address of the location.
countryStringThe country associated with the physical address of the location.
updated_atTimestampThe timestamp indicating the last time the location was updated.
nodesArray of objectsThe details of the nodes associated with the location.

Errors

The following are errors returned by this API. For a complete list of common errors, see Common errors.

CodeMessageCause
---

Examples

Example: Retrieve details about a location.

This example retrieves the details of the location with template name test-location.

ruby api.rb <customer_code> get api/locations/test-location

Response

{
    "location_id": 25844,
    "name": "Test Location",
    "template_name": "test-location",
    "addressline1": "123 Test Way",
    "addressline2": null,
    "city": "Austin",
    "state": "TX",
    "zipcode": "11111",
    "country": "US",
    "updated_at": "2024-10-02T15:31:00.243Z",
    "nodes": [
        {
            "node_id": 120081,
            "hostname": "sit0000red0",
            "keepalive": "unknown",
            "keepalive_timestamp": 1727882885,
            "last_online": "unknown",
            "hardware_type": "test hardware",
            "updated_at": "2024-10-02T15:31:00.208Z"
        },
        {
            "node_id": 120082,
            "hostname": "sit0000red1",
            "keepalive": "unknown",
            "keepalive_timestamp": 1727882885,
            "last_online": "unknown",
            "hardware_type": "test hardware",
            "updated_at": "2024-10-02T15:31:00.232Z"
        }
    ]
}