The Stock List API is a powerful tool for querying your stock data. It provides a flexible way to filter, sort, and select the data you need. The API uses a POST request to the endpoint /stock/list
.
Request Payload
The request payload is a JSON object that specifies the criteria for the stock data you want to retrieve. Here's an example of a request payload:
{
"criteria": {
"product": {
"eq": "string",
"neq": "string",
"null": true,
"in": [
"string"
],
"nin": [
"string"
]
},
...
},
"extra": {
"partiallyDelivered": true
},
"sort": [
{
"field": "product.name"
}
],
"limit": 100,
"offset": 200,
"select": [
"id",
"product",
"warehouse",
...
],
"nested": true
}
The criteria
object contains various fields that you can use to filter the stock data. Each field can have multiple filter conditions, such as eq
(equals), neq
(not equals), null
(is null), in
(in array), and nin
(not in array).
The extra
object can contain additional parameters that modify the behavior of the request. In this example, partiallyDelivered
is set to true
.
The sort
array specifies the sorting order of the returned data. Each element in the array is an object that specifies the field to sort by.
The limit
and offset
fields are used for pagination. limit
specifies the maximum number of records to return, and offset
specifies the number of records to skip.
The select
array specifies the fields to include in the returned data.
The nested
field is a boolean that determines whether to return nested objects or just their IDs.
Response Payload
The response payload is a JSON object that contains the requested stock data. Here's an example of a response payload:
{
"results": {
"id": "529baf4b-b7f1-4ff4-827f-b05f52a1a22f",
"product": "529baf4b-b7f1-4ff4-827f-b05f52a1a22f",
"warehouse": "529baf4b-b7f1-4ff4-827f-b05f52a1a22f",
...
},
"paging": {
"returned": 10,
"from": 5,
"to": 15,
"total": 30
}
}
The results
object contains the stock data that matches the criteria specified in the request. Each field in the results
object corresponds to a field specified in the select
array in the request.
The paging
object contains information about the pagination of the results. returned
is the number of records returned in the current request, from
and to
specify the range of records returned, and total
is the total number of records that match the criteria.
Please note that the actual response will contain more detailed information based on the fields specified in the select
array in the request.
β