Box API
The Box API can create, get, update, delete, and list boxes which store inventory items.
Note that inventory “boxes” store item entries, each of which represents a real “container”. Containers are typically bags, but may be boxes (not inventory boxes though) in some cases.
All routes except item retrieval require authentication, which is handled by auth.
Idempotent routes use the GET method while non-idempotent routes use POST.
- Base Box API endpoint:
/api/box/when the response contains zero or onemodels.Box/api/boxes/when the response contains two or moremodels.Boxes
- api_box_routes.api_box_get_static(box_id)
Get a single inventory box by box ID. Route forms a permalink (static) URL.
GET /api/box/get/<box_id>
- Returns:
200on success withmodels.Box,400if box ID was malformed,404if box was not found
- api_box_routes.api_box_get_dynamic()
Get a single inventory box by box ID. Route URL is mutable by box ID (dynamic).
GET /api/box/get?box_id=<box_id> POST /api/box/get [<box_id>]
- Returns:
200on success with the desiredmodels.Box,400if box ID was not found,400if box ID was malformed,404if box was not found,500if box ID was not the expected length
- api_box_routes.api_box_create()
Create an inventory box with provided name attribute.
POST /api/box/create [<name>, <api_key>]
Box ID will be generated programmatically and returned in the success model.
models.Boxcontains a variety of attributes, however the only user-mutable attribute is the box name.Requires authentication scope
auth.Scope.BOX_CREATE- Returns:
200on success with the createdmodels.Box,400if a box with the desired name already exists,400if API key was malformed,401if API key was invalid,403if user does not have required scope,404if user was not found,404if name was malformed,500if any other error while authenticating
- api_box_routes.api_box_update()
Update one or more attributes on a single inventory box, identified by box ID.
POST /api/box/update [<name>, <box_id>, <api_key>]
models.Boxcontains a variety of attributes, however the only user-mutable attribute is the box name. All other attributes cannot be updated.Requires authentication scope
auth.Scope.BOX_UPDATE- Returns:
200on success with the updatedmodels.Box,400if no attributes to update were provided,400if box ID was malformed,400if API key was malformed,401if API key was invalid,403if user does not have required scope,404if box was not found before updating,404if box was not found after updating,500if any other error while authenticating
- api_box_routes.api_box_delete()
Delete a single inventory box, identified by box ID.
POST /api/box/delete [<box_id>, <api_key>]
Requires authentication scope
auth.Scope.BOX_DELETE- Returns:
200on success with the deletedmodels.Box,400if box ID was malformed,400if API key was malformed,401if API key was invalid,403if user does not have required scope,404if box was not found,500if more than one box was found,500if any other error while authenticating
- api_box_routes.api_boxes_list()
List one or more inventory boxes with optional ordering.
GET /api/boxes/list?sortby={*<box_attributes>}&direction={ASC,DESC}&limit=<limit>&offset=<offset> POST /api/boxes/list [sortby={*<box_attributes>}, <direction={ASC,DESC}>, <limit>, <offset>]Available (all optional) parameters:
sortby: the name of any attribute inmodels.Box(as a string). Results will then be sorted based based on this column. No sorting by default.direction: eitherASCto sort the results in ascending order orDESCto sort the results in descending order.ASCby default.limit: the (maximum) number of returned boxes.common.RET_ENTITIES_DEF_LIMITdefault, up to a maximum ofcommon.RET_ENTITIES_MAX_LIMIT.offset: the index offset within the database to respond with. 0 by default.
- Returns:
200on success with a list ofmodels.Boxes,400if any sorting attributes were malformed,400ifsortbyis present and is not a valid sort key,400ifdirectionis notASCorDESC,400iflimitis not an integer (digit string),400ifoffsetis not an integer (digit string)
- api_box_routes.api_boxes_count()
Count the total number of inventory boxes.
GET /api/boxes/count
This endpoint does not follow a standard
models.Modellist format. Instead, the count is embedded within the standard response body as{ 'count': box_count (int) }
- Returns:
200on success with the total box count (see formatting above),500if the box count returned a non-one number of values