GET v3/stock
GET/v3/stock
List stock per product and stock location, with pagination.
The GET v3/stock endpoint will return up to 100 stock records at a time. The definition of stock is products at a stockLocation with shared characteristics. This means that whenever two identical products are located at the same stockLocation, that both share all related attributes such as lotNumber, expirationDate, etc.
Pagination
The endpoint supports pagination to split the large collection of resources into smaller, more manageable chunks or pages. This helps to reduce the response size and to improve performance. The endpoint supports only cursor-based technique for pagination.
- See also this article on pagination.
Filters
The GET v3/stock endpoint supports filtering on the attributes sku, locationType and modifiedOn. Each of these are explained below. Filters can be used in combination with eachother and with pagination to allow full access to the desired subset of stock.
Filtering on modifiedOn
The results returned by this service can be filtered based on the modification date (and time) of the stock. To do so make use of the filter[modifiedOn] parameter in the following manner:
GET {host}/v3/stock?filter[modifiedOn][lt]={date}will return stock that has been modified before the provided date. Stock that has been modified on that date is not included in the results.GET {host}/v3/stock?filter[modifiedOn][gt]={date}will return stock that has been modified after the provided date. Stock that has been modified on that date is not included in the results.GET {host}/v3/stock?filter[modifiedOn][gt]={date_1}&filter[modifiedOn][lt]={date_2}will return stock that have modified between dates{date_1}and{date_1}. Stock that has been modified on either date is not included in the results.
Filtering on locationType
By specifying one or more locationType values the stock returned will be filtered on that type. See the documentation of locationType for more details on the options.
GET {host}/v3/stock?filter[locationType][in]=INBOUND,PALLETwill return all stock on either location.
Filtering on sku
By specifying the product sku it is possible to look for stock of that product specifically. Be aware that the SKU's must be URL encoded to avoid being interpreted incorrecly.
GET {host}/v3/stock?filter[sku][in]=09238532,TRS-001-1will return the stock for the specifiedsku.
Filtering on expirationStatus
By specifying one or more expirationStatus values the stock returned will be filtered on that status. See the documentation of expirationStatus for more details on the options.
Including related resources
The endpoint also supports -to some degree- the inclusion of information of related resources. This option is provided to allow clients used to the v2 version of the stock endpoint to be able to use the v3 version more seemlessly. To get the details of related entities the include parameter must be added to the URI in the following way:
GET {host}/v3/stock?include=stockLocationwill return the stock with somestockLocationrelated details
Note: inclusion of product has been deprecated
Limitations of GET v3/stock
- At most 100
stockresources are returned regardles of the value provided by thepage[size]query parameter. - Ordering is by
idand in ascending order. - Users are rate-limited to 5000 requests per hour on this service.
Request
Responses
- 200
- 401
- 403
- 406
- 415
- 429
Response for the GET v3/stock endpoint
401 Unauthorized
A 401 Unauthorized response occurs when attempting to access a resource or perform an action that requires authentication, but no valid credentials have been provided. It indicates that the requester is unauthorized to access the requested resource.
The following are common scenarios that may lead to a 401 Unauthorized response:
- Attempting to access a protected API endpoint without providing authentication credentials.
- Providing an invalid or expired authentication token.
- Providing valid authentication credentials, but lacking sufficient privileges to access the requested resource.
- Providing authentication credentials that are valid for a different resource or API endpoint than the one being requested.
403 Forbidden
The HTTP 403 Forbidden client error response status code indicates that the server understood the request but refused to process it. This status is similar to 401 Unauthorized, except that for 403 Forbidden responses, authenticating or re-authenticating makes no difference. The request failure is tied to application logic, such as insufficient permissions to a resource or action.
406 Not Acceptable
A 406 Not Acceptable response occurs when the server cannot provide a response that matches the client's requested format or content language for the requested resource. For instance, if a client sends an Accept header of text/html to an API endpoint that only supports application/json responses, the server would respond with a 406 Not Acceptable status code. This type of response is a required response for JSON:API compatible endpoints.
415 Unsupported Media Type
A 415 Unsupported Media Type response occurs when the server cannot process the request because the media type specified in the request is not supported for the requested resource. For example, if a client sends a request with a Content-Type header of application/pdf to an API endpoint that only supports application/json (the only valid media type for JSON:API), the server would respond with a 415 Unsupported Media Type status code. This type of error-response is a required for JSON:API compatible endpoints.
429 Too Many Requests
The request could not be completed because of a rate limit violation.