Skip to main content

POST - Create new location

Create new location

Request

  • Method: POST
  • Endpoint: /locations
  • Base URL: https://api.targpatrol.com/api/v1
  • Operation ID: create-new-location

Authorization

This endpoint requires an external API key.

x-api-key: {your_external_api_key}

Request Body

Required: yes Content-Type: application/json Schema: LocationRequest

Schema
{
"$ref": "#/components/schemas/LocationRequest"
}

Example: example-1

{
"name": "W001",
"address": "Walmart 11,197",
"latitude": 51.0966229,
"longitude": -138.491986,
"graphicPlanIds": [],
"tags": [
"tag1"
]
}

Responses

201 OK

Content-Type: application/json Schema: LocationResponse

Schema
{
"$ref": "#/components/schemas/LocationResponse"
}

Example: example-1

{
"id": "638b90c5-7965-49ae-a02b-1b190cb216db",
"name": "W001",
"address": "Walmart 11,197",
"latitude": 51.0966229,
"longitude": -138.491986,
"tags": [
"tag1"
],
"graphicPlanIds": []
}

400 Bad request

Content-Type: application/json Schema: ErrorResponse

Schema
{
"$ref": "#/components/schemas/ErrorResponse"
}

Example: example-1

{
"message": "validation failed",
"code": "validation.failed",
"timestamp": "2023-03-07T05:57:59.315Z",
"details": [
{
"message": "must not be blank",
"code": "validation.notblank.failed",
"identifier": "name"
},
{
"message": "must not be empty",
"code": "validation.notemptystring.failed",
"identifier": "address"
},
{
"message": "must not be null",
"code": "validation.nonull.failed",
"identifier": "tags"
}
]
}

401 Unauthorized

406 Not Acceptable

Content-Type: application/json Schema: ErrorResponse

Schema
{
"$ref": "#/components/schemas/ErrorResponse"
}

Example: example-1

{
"message": "mismatch in the types of content",
"code": "not.acceptable",
"timestamp": "2023-03-07T05:57:59.315Z"
}

500 Internal Server Error

Content-Type: application/json Schema: ErrorResponse

Schema
{
"$ref": "#/components/schemas/ErrorResponse"
}

Example: example-1

{
"message": "internal server error",
"code": "internal.server.error",
"timestamp": "2023-03-07T05:57:59.315Z"
}