Delete a location

Delete a location

DELETE api/locations/template_name

Deletes an existing location, specified by the template_name of the location. All nodes associated with the location are moved to the Unassigned 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

delete 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": timestamp,
            "last_online": "timestamp",
            "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 deleted location.
template_nameStringThe template name of the deleted location.
addressline1StringThe first line of the physical address of the deleted location.
addressline2StringThe second line of the physical address of the deleted location.
cityStringThe city where the deleted location was physically located.
stateStringThe state where the deleted location was physically located.
zipcodeStringThe zip code where the deleted location was physically located.
countryStringThe country where the deleted location was physically located.
updated_atTimestampThe timestamp indicating when the location was last updated.
nodesArray of ObjectsThe details of the nodes that were associated with the deleted location.

Errors

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

CodeMessageCause
---

Examples

Example: Delete a location

This example deletes a location with template name test-location.

ruby api.rb <customer_code> delete /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": "sit0001red0",
            "keepalive": "unknown",
            "keepalive_timestamp": 1727882885,
            "last_online": "unknown",
            "hardware_type": "test hardware",
            "updated_at": "2024-10-02T15:31:00.208Z"
        },
        {
            "node_id": 120082,
            "hostname": "sit0001red1",
            "keepalive": "unknown",
            "keepalive_timestamp": 1727882885,
            "last_online": "unknown",
            "hardware_type": "test hardware",
            "updated_at": "2024-10-02T15:31:00.232Z"
        }
    ]
}