.. _warehouses-api: Warehouses API ============== The ``/api/warehouses`` endpoint exposes the :ref:`Warehouse Model ` as a resource. Warehouses contain bin locations, which can in turn contain stock for individual products. .. http:get:: /api/warehouses Query all warehouses or a subset of warehouses according to a set of criteria. :query integer start: the starting offset into the result list (default: 0) :query integer limit: the maximum number of results (default: 1000) :query object filter: a search filter (see :ref:`filter_and_sort_query_parameters`), with property names prefixed by ``warehouse.``, for example ``warehouse.name`` :query object sort: a sorting specification (see :ref:`filter_and_sort_query_parameters`), with property names prefixed by ``warehouse.``, for example ``warehouse.name`` :>json boolean success: whether the operation was successful :>json integer total: the total number of warehouses which matched the query :>json array data: an array of warehouses, see :ref:`the single-warehouse endpoint ` for a description of the resource properties **Example request**: .. http:example:: curl wget httpie GET /api/warehouses HTTP/1.1 Host: localhost Accept: application/json **Example response**: .. code-block:: http HTTP/1.1 200 OK Content-Type: application/json { "success": true, "total": 1, "data": [ { "id": 1, "code": "MW", "name": "Main Warehouse", "stockAvailableForSale": true, "defaultWarehouse": true, "defaultReturnShipmentWarehouse": true, "nullBinLocationId": 12, "contact": "Jane Doe", "email": "jane.doe@pickware.com", "phone": "+1 93283 329493", "address": "3793 Blair Court, Rockville MO", "comment": "A comment", "binLocationFormatComponents": [] } ] } .. _get-warehouse: .. http:get:: /api/warehouses/{id} Fetch a warehouse by its database ID. :param integer id: the database ID of the warehouse to fetch :>json boolean success: whether the operation was successful :>json object data: the warehouse with the given ID :>json integer data.id: the database ID of the warehouse :>json string data.code: the warehouses's shorthand code :>json string data.name: the warehouse's readable name :>json boolean data.stockAvailableForSale: whether the stock inside the warehouse should count towards the available stock of the online shop :>json boolean data.defaultWarehouse: whether this is the default warehouse :>json boolean data.defaultReturnShipmentWarehouse: whether this is the default warehouse for return shipments :>json string data.nullBinLocationId: database ID of the unknown bin location of this warehouse :>json string data.contact: the name of the person responsible for the warehouse :>json string data.email: the email address of the person responsible for the warehouse :>json string data.phone: the phone number of the person responsible for the warehouse :>json string data.address: the street address of the warehouse :>json string data.comment: an arbitrary comment for the warehouse :>json array data.binLocationFormatComponents: a specification of the format for bin location codes **Example request**: .. http:example:: curl wget httpie GET /api/warehouses/2 HTTP/1.1 Host: localhost Accept: application/json **Example response**: .. code-block:: http HTTP/1.1 200 OK Content-Type: application/json { "success": true, "data": { "id": 2, "code": "SW", "name": "Secondary Warehouse", "stockAvailableForSale": false, "defaultWarehouse": false, "defaultReturnShipmentWarehouse": false, "nullBinLocationId": 23, "contact": "", "email": "", "phone": "", "address": "", "comment": "", "binLocationFormatComponents": [] } } .. http:post:: /api/warehouses Create a new warehouse. :