# Locations

## Retrieving all locations for a site

> Retrieves all locations for a specified site.\
> \*\*\*\
> \
> \*\*Required scopes\*\*\
> \*  \`availability.availability\_view\`

OpenAPI:

```json
{"openapi":"3.0.0","info":{"title":"Availability Service","version":"0.0.1"},"tags":[{"name":"Locations"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["availability.availability_view"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"availability.availability_view":"view_availability","availability.availability_manage":"manage_availability"}}}}}},"paths":{"/availability/{tenant}/locations/{site}":{"get":{"tags":["Locations"],"summary":"Retrieving all locations for a site","description":"Retrieves all locations for a specified site.\n***\n\n**Required scopes**\n*  `availability.availability_view`","responses":{"200":{"description":"The request was successful. A list of locations is returned.","content":{"application/json":{"schema":{"type":"array","items":{"description":"Physical location of the product.","type":"object","properties":{"id":{"type":"string","description":"Unique identifier of the location. \n\n**Note**: The value should be provided in the `site`:`rack` format."},"site":{"type":"string","description":"Site code, defined when the site is created. The value should match the `site` query/path parameter value."},"rack":{"type":"string","description":"Rack number."},"rackName":{"type":"string","description":"Name of the rack."},"order":{"type":"number","description":"Order of the location, expressed as a number.","minimum":0}},"required":["id","site","order"]}}}}},"400":{"description":"The request was syntactically incorrect. Details are provided in the response.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status Description."},"message":{"type":"string","description":"Error message."},"_embedded":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"message":{"description":"Detailed message of the exception.","type":"string"}}}}}}}}}}},"401":{"description":"The authorization token is invalid or has expired. Details are provided in the response.","content":{"application/json":{"schema":{"properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"403":{"description":"Provided authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status Description."},"message":{"type":"string","description":"Error message."}}}}}},"404":{"description":"The requested resource was not found.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"message":{"type":"string","description":"Detailed error message."}}}}}},"500":{"description":"Some server-side error occurred. Details are provided in the response.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Detailed error message"}}}}}}},"operationId":"GET-availability-retrieve-locations-site"}}}}
```

## Adding a new location to a site

> Adds a new location to a specified site.\
> \*\*\*\
> \
> \*\*Required scopes\*\*\
> \*  \`availability.availability\_manage\`

OpenAPI:

```json
{"openapi":"3.0.0","info":{"title":"Availability Service","version":"0.0.1"},"tags":[{"name":"Locations"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["availability.availability_manage"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"availability.availability_view":"view_availability","availability.availability_manage":"manage_availability"}}}}}},"paths":{"/availability/{tenant}/locations/{site}":{"post":{"tags":["Locations"],"summary":"Adding a new location to a site","description":"Adds a new location to a specified site.\n***\n\n**Required scopes**\n*  `availability.availability_manage`","requestBody":{"content":{"application/json":{"schema":{"description":"Physical location of the product.","type":"object","properties":{"id":{"type":"string","description":"Unique identifier of the location. \n\n**Note**: The value should be provided in the `site`:`rack` format."},"site":{"type":"string","description":"Site code, defined when the site is created. The value should match the `site` query/path parameter value."},"rack":{"type":"string","description":"Rack number."},"rackName":{"type":"string","description":"Name of the rack."},"order":{"type":"number","description":"Order of the location, expressed as a number.","minimum":0}},"required":["id","site","order"]}}}},"responses":{"201":{"description":" The request was successful. The location has been added to the site.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"The response message of the operation."},"code":{"type":"number","description":"The result code of the operation."}}}}}},"400":{"description":"The request was syntactically incorrect. Details are provided in the response.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status Description."},"message":{"type":"string","description":"Error message."},"_embedded":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"message":{"description":"Detailed message of the exception.","type":"string"}}}}}}}}}}},"401":{"description":"The authorization token is invalid or has expired. Details are provided in the response.","content":{"application/json":{"schema":{"properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"403":{"description":"Provided authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status Description."},"message":{"type":"string","description":"Error message."}}}}}},"409":{"description":"Resource already exists.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"message":{"type":"string","description":"Detailed error message."}}}}}},"500":{"description":"Some server-side error occurred. Details are provided in the response.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Detailed error message"}}}}}}},"operationId":"POST-availability-add-locations-site"}}}}
```

## Updating locations

> Updates locations for a specified site.\
> \*\*\*\
> \
> \*\*Required scopes\*\*\
> \*  \`availability.availability\_manage\`

OpenAPI:

```json
{"openapi":"3.0.0","info":{"title":"Availability Service","version":"0.0.1"},"tags":[{"name":"Locations"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["availability.availability_manage"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"availability.availability_view":"view_availability","availability.availability_manage":"manage_availability"}}}}}},"paths":{"/availability/{tenant}/locations/{site}":{"put":{"tags":["Locations"],"summary":"Updating locations","description":"Updates locations for a specified site.\n***\n\n**Required scopes**\n*  `availability.availability_manage`","requestBody":{"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier of the location."},"order":{"type":"number","description":"Order of the location, expressed as a number."}}}}}}},"responses":{"200":{"description":" The request was successful. The locations have been updated.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"The response message of the operation."},"code":{"type":"number","description":"The result code of the operation."}}}}}},"400":{"description":"The request was syntactically incorrect. Details are provided in the response.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status Description."},"message":{"type":"string","description":"Error message."},"_embedded":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"message":{"description":"Detailed message of the exception.","type":"string"}}}}}}}}}}},"401":{"description":"The authorization token is invalid or has expired. Details are provided in the response.","content":{"application/json":{"schema":{"properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"403":{"description":"Provided authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status Description."},"message":{"type":"string","description":"Error message."}}}}}},"500":{"description":"Some server-side error occurred. Details are provided in the response.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Detailed error message"}}}}}}},"operationId":"PUT-availability-update-locations-site"}}}}
```

## Deleting a location

> Deletes a specified location.\
> \
> \*\*\*\
> \
> \*\*Required scopes\*\*\
> \*  \`availability.availability\_manage\`

OpenAPI:

```json
{"openapi":"3.0.0","info":{"title":"Availability Service","version":"0.0.1"},"tags":[{"name":"Locations"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["availability.availability_manage"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"availability.availability_view":"view_availability","availability.availability_manage":"manage_availability"}}}}}},"paths":{"/availability/{tenant}/locations/{location}":{"delete":{"tags":["Locations"],"summary":"Deleting a location","description":"Deletes a specified location.\n\n***\n\n**Required scopes**\n*  `availability.availability_manage`","parameters":[{"in":"path","name":"tenant","required":true,"description":"Your Emporix tenant's name.\n\n**Note**: The tenant name should always be provided in lowercase.\n","schema":{"type":"string"}},{"in":"path","name":"location","required":true,"description":"Location's unique identifier.","schema":{"type":"string"}}],"responses":{"200":{"description":" The request was successful. The location has been deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"The response message of the operation."},"code":{"type":"number","description":"The result code of the operation."}}}}}},"401":{"description":"The authorization token is invalid or has expired. Details are provided in the response.","content":{"application/json":{"schema":{"properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"403":{"description":"Provided authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status Description."},"message":{"type":"string","description":"Error message."}}}}}},"500":{"description":"Some server-side error occurred. Details are provided in the response.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Detailed error message"}}}}}}},"operationId":"DELETE-availability-remove-location"}}}}
```

## Retrieving product locations

> Retrieves locations of specified products.\
> \*\*\*\
> \
> \*\*Required scopes\*\*\
> \*  \`availability.availability\_view\`

OpenAPI:

```json
{"openapi":"3.0.0","info":{"title":"Availability Service","version":"0.0.1"},"tags":[{"name":"Locations"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["availability.availability_view"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"availability.availability_view":"view_availability","availability.availability_manage":"manage_availability"}}}}}},"paths":{"/availability/{tenant}/search/locations":{"post":{"summary":"Retrieving product locations","description":"Retrieves locations of specified products.\n***\n\n**Required scopes**\n*  `availability.availability_view`","parameters":[{"in":"path","name":"tenant","required":true,"description":"Your Emporix tenant's name.\n\n**Note**: The tenant name should always be provided in lowercase.\n","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"site":{"type":"string","description":"Site code, defined when the site is created."},"productIds":{"type":"array","description":"List of product IDs. A product IDs is generated when the product is created through the Product Service.","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"The request was successful. A list of locations is returned.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","description":"Unique identifier of the product, generated when the product is created through the Product Service."},"locations":{"type":"array","description":"List of product's physical locations.","items":{"type":"object","properties":{"site":{"type":"string","description":"Site code, defined when the site is created."},"zone":{"type":"string","description":"Unique identifier of the zone."},"rack":{"type":"string","description":"Rack number."},"rackName":{"type":"string","description":"Name of the rack."},"shelf":{"type":"string","description":"Unique identifier of the shelf."},"section":{"type":"string","description":"Unique identifier of the section."},"bin":{"type":"string","description":"Unique identifier of the bin."},"order":{"type":"number","description":"Order of the location, expressed as a number."}}}}}},"description":""}}}},"400":{"description":"The request was syntactically incorrect. Details are provided in the response.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status Description."},"message":{"type":"string","description":"Error message."},"_embedded":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"message":{"description":"Detailed message of the exception.","type":"string"}}}}}}}}}}},"401":{"description":"The authorization token is invalid or has expired. Details are provided in the response.","content":{"application/json":{"schema":{"properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"403":{"description":"Provided authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status Description."},"message":{"type":"string","description":"Error message."}}}}}},"404":{"description":"The requested resource was not found.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"message":{"type":"string","description":"Detailed error message."}}}}}},"500":{"description":"Some server-side error occurred. Details are provided in the response.","content":{"application/json":{"schema":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Detailed error message"}}}}}}},"operationId":"POST-availability-search-locations","tags":["Locations"]}}}}
```
