# Locations

## Retrieving all locations for a site

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

```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"}}}}},"schemas":{"LocationList":{"type":"array","items":{"$ref":"#/components/schemas/Location"}},"Location":{"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"]},"BadRequest400":{"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"}}}}}}}},"Unauthorized401":{"properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}},"Forbidden403":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status Description."},"message":{"type":"string","description":"Error message."}}},"NotFound404":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"message":{"type":"string","description":"Detailed error message."}}},"UnexpectedError":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Detailed error message"}}}},"responses":{"BadRequestResponse400":{"description":"The request was syntactically incorrect. Details are provided in the response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequest400"}}}},"UnauthorizedResponse401":{"description":"The authorization token is invalid or has expired. Details are provided in the response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unauthorized401"}}}},"ForbiddenResponse403":{"description":"Provided authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Forbidden403"}}}},"NotFoundResponse404":{"description":"The requested resource was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound404"}}}},"ServerErrorResponse500":{"description":"Some server-side error occurred. Details are provided in the response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnexpectedError"}}}}}},"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":{"$ref":"#/components/schemas/LocationList"}}}},"400":{"$ref":"#/components/responses/BadRequestResponse400"},"401":{"$ref":"#/components/responses/UnauthorizedResponse401"},"403":{"$ref":"#/components/responses/ForbiddenResponse403"},"404":{"$ref":"#/components/responses/NotFoundResponse404"},"500":{"$ref":"#/components/responses/ServerErrorResponse500"}},"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\`

```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"}}}}},"schemas":{"Location":{"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"]},"SuccessResponse":{"type":"object","properties":{"message":{"type":"string","description":"The response message of the operation."},"code":{"type":"number","description":"The result code of the operation."}}},"BadRequest400":{"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"}}}}}}}},"Unauthorized401":{"properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}},"Forbidden403":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status Description."},"message":{"type":"string","description":"Error message."}}},"Conflict409":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"message":{"type":"string","description":"Detailed error message."}}},"UnexpectedError":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Detailed error message"}}}},"responses":{"BadRequestResponse400":{"description":"The request was syntactically incorrect. Details are provided in the response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequest400"}}}},"UnauthorizedResponse401":{"description":"The authorization token is invalid or has expired. Details are provided in the response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unauthorized401"}}}},"ForbiddenResponse403":{"description":"Provided authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Forbidden403"}}}},"ConflictResponse409":{"description":"Resource already exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Conflict409"}}}},"ServerErrorResponse500":{"description":"Some server-side error occurred. Details are provided in the response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnexpectedError"}}}}}},"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":{"$ref":"#/components/schemas/Location"}}}},"responses":{"201":{"description":" The request was successful. The location has been added to the site.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestResponse400"},"401":{"$ref":"#/components/responses/UnauthorizedResponse401"},"403":{"$ref":"#/components/responses/ForbiddenResponse403"},"409":{"$ref":"#/components/responses/ConflictResponse409"},"500":{"$ref":"#/components/responses/ServerErrorResponse500"}},"operationId":"POST-availability-add-locations-site"}}}}
```

## Updating locations

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

```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"}}}}},"schemas":{"LocationOrderList":{"type":"array","items":{"$ref":"#/components/schemas/LocationOrder"}},"LocationOrder":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier of the location."},"order":{"type":"number","description":"Order of the location, expressed as a number."}}},"SuccessResponse":{"type":"object","properties":{"message":{"type":"string","description":"The response message of the operation."},"code":{"type":"number","description":"The result code of the operation."}}},"BadRequest400":{"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"}}}}}}}},"Unauthorized401":{"properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}},"Forbidden403":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status Description."},"message":{"type":"string","description":"Error message."}}},"UnexpectedError":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Detailed error message"}}}},"responses":{"BadRequestResponse400":{"description":"The request was syntactically incorrect. Details are provided in the response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequest400"}}}},"UnauthorizedResponse401":{"description":"The authorization token is invalid or has expired. Details are provided in the response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unauthorized401"}}}},"ForbiddenResponse403":{"description":"Provided authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Forbidden403"}}}},"ServerErrorResponse500":{"description":"Some server-side error occurred. Details are provided in the response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnexpectedError"}}}}}},"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":{"$ref":"#/components/schemas/LocationOrderList"}}}},"responses":{"200":{"description":" The request was successful. The locations have been updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestResponse400"},"401":{"$ref":"#/components/responses/UnauthorizedResponse401"},"403":{"$ref":"#/components/responses/ForbiddenResponse403"},"500":{"$ref":"#/components/responses/ServerErrorResponse500"}},"operationId":"PUT-availability-update-locations-site"}}}}
```

## Deleting a location

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

```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"}}}}},"parameters":{"tenant-path":{"in":"path","name":"tenant","required":true,"description":"Your Emporix tenant name.\n\n**Note**: The tenant name should always be provided in lowercase.\n","schema":{"type":"string"}},"location-path":{"in":"path","name":"location","required":true,"description":"Location unique identifier.","schema":{"type":"string"}}},"schemas":{"SuccessResponse":{"type":"object","properties":{"message":{"type":"string","description":"The response message of the operation."},"code":{"type":"number","description":"The result code of the operation."}}},"Unauthorized401":{"properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}},"Forbidden403":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status Description."},"message":{"type":"string","description":"Error message."}}},"UnexpectedError":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Detailed error message"}}}},"responses":{"UnauthorizedResponse401":{"description":"The authorization token is invalid or has expired. Details are provided in the response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unauthorized401"}}}},"ForbiddenResponse403":{"description":"Provided authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Forbidden403"}}}},"ServerErrorResponse500":{"description":"Some server-side error occurred. Details are provided in the response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnexpectedError"}}}}}},"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":[{"$ref":"#/components/parameters/tenant-path"},{"$ref":"#/components/parameters/location-path"}],"responses":{"200":{"description":" The request was successful. The location has been deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"$ref":"#/components/responses/UnauthorizedResponse401"},"403":{"$ref":"#/components/responses/ForbiddenResponse403"},"500":{"$ref":"#/components/responses/ServerErrorResponse500"}},"operationId":"DELETE-availability-remove-location"}}}}
```

## Retrieving product locations

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

```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"}}}}},"parameters":{"tenant-path":{"in":"path","name":"tenant","required":true,"description":"Your Emporix tenant name.\n\n**Note**: The tenant name should always be provided in lowercase.\n","schema":{"type":"string"}}},"schemas":{"LocationSearch":{"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"}}}},"ProductLocationList":{"type":"array","items":{"$ref":"#/components/schemas/ProductLocation"},"description":""},"ProductLocation":{"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 physical locations.","items":{"$ref":"#/components/schemas/GenericLocation"}}}},"GenericLocation":{"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."}}},"BadRequest400":{"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"}}}}}}}},"Unauthorized401":{"properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}},"Forbidden403":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status Description."},"message":{"type":"string","description":"Error message."}}},"NotFound404":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"message":{"type":"string","description":"Detailed error message."}}},"UnexpectedError":{"properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Detailed error message"}}}},"responses":{"BadRequestResponse400":{"description":"The request was syntactically incorrect. Details are provided in the response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequest400"}}}},"UnauthorizedResponse401":{"description":"The authorization token is invalid or has expired. Details are provided in the response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unauthorized401"}}}},"ForbiddenResponse403":{"description":"Provided authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Forbidden403"}}}},"NotFoundResponse404":{"description":"The requested resource was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound404"}}}},"ServerErrorResponse500":{"description":"Some server-side error occurred. Details are provided in the response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnexpectedError"}}}}}},"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":[{"$ref":"#/components/parameters/tenant-path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationSearch"}}}},"responses":{"200":{"description":"The request was successful. A list of locations is returned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductLocationList"}}}},"400":{"$ref":"#/components/responses/BadRequestResponse400"},"401":{"$ref":"#/components/responses/UnauthorizedResponse401"},"403":{"$ref":"#/components/responses/ForbiddenResponse403"},"404":{"$ref":"#/components/responses/NotFoundResponse404"},"500":{"$ref":"#/components/responses/ServerErrorResponse500"}},"operationId":"POST-availability-search-locations","tags":["Locations"]}}}}
```
