Create Location
This method is used to create a location object within the specified domain.
note
The location name must be unique within a domain.
Request Parameters
POST /api/clients/v1/locations/
Headers
- Content-Type: application/json
- Authorization: Bearer
$access_token
JSON body
| Parameter | Type | Constraints | Description | Example |
|---|---|---|---|---|
| name | string | Required | Location name | /images |
| type | string | matching | named | Location type. Default is matching | matching |
| domain_id | integer | > 0. Required | Domain ID | 1 |
| headers | object[] | < 10 | List of additional HTTP headers | |
| headers.key | string | < 1024 | Header name | X-MEDIA-TYPE |
| headers.value | string | < 32768 | Header value | .pptx |
| cors_headers | object{} | CORS headers object | ||
| cors_headers.access_control_allow_origin | object[string] | < 50 | Allowed origins | ["example.com"] |
| cors_headers.access_control_expose_headers | object[string] | < 50 | Headers exposed to the browser | ["X-MEDIA-TYPE"] |
| cors_headers.access_control_max_age | integer | < 86400 | How long results can be cached (seconds) | 600 |
| cors_headers.access_control_allow_credentials | boolean | Whether credentials are allowed | true | |
| cors_headers.access_control_allow_methods | object[string] | OPTIONS | GET | HEAD | PUT | PATCH | POST | DELETE | Allowed HTTP methods | ["OPTIONS"] |
| cors_headers.access_control_allow_headers | object[string] | < 50 | Allowed request headers | [*] |
Response Parameters
JSON body
| Parameter | Type | Description |
|---|---|---|
| id | integer | Location ID |
| name | string | Location name |
| type | string | Location type |
| domain_id | integer | Domain ID |
| headers | object[] | List of additional HTTP headers |
| headers.key | string | Header name |
| headers.value | string | Header value |
| cors_headers | object{} | CORS headers object |
| cors_headers.access_control_allow_origin | object[string] | Allowed origins |
| cors_headers.access_control_expose_headers | object[string] | Exposed headers |
| cors_headers.access_control_max_age | integer | Cache duration for preflight response |
| cors_headers.access_control_allow_credentials | boolean | Whether credentials are allowed |
| cors_headers.access_control_allow_methods | object[string] | Allowed HTTP methods |
| cors_headers.access_control_allow_headers | object[string] | Allowed request headers |
201 Created
Location object
{
"id": 1,
"name": "/images",
"type": "matching",
"domain_id": 1,
"headers": [
{
"key": "X-MEDIA-TYPE",
"value": ".pptx"
}
],
"cors_headers": {
"access_control_allow_origin": [
"*"
],
"access_control_expose_headers": [
"*"
],
"access_control_max_age": 600,
"access_control_allow_credentials": true,
"access_control_allow_methods": [
"OPTIONS"
],
"access_control_allow_headers": [
"X-MEDIA-TYPE"
]
}
}
400 Bad Request
Invalid or missing required body parameters
{
"domain_id": [
"Domain with ID {domain_id} not found"
],
"name": [
"Invalid location name"
],
"headers": [
"Invalid header key"
]
}
401 Unauthorized
Authentication credentials are missing or invalid
{
"detail": "Given token not valid for any token type",
"code": "token_not_valid",
"messages": [
{
"token_class": "AccessToken",
"token_type": "access",
"message": "Token is invalid or expired"
}
]
}
403 Forbidden
Location can only be linked to a domain of your own project
{
"detail": "Only participants can view this project's locations"
}
409 Conflict
A location with these parameters already exists
{
"detail": "Location already exists"
}