Lists Stocks using several optional parameters



Fetches requested aspects of Stock, through the use of several fields in an array: "name", "code", "in_stock", "average_cost", "price", "nominal_code", "tax_rate", "description", "notes", "id", "price_bands"


Condition which only fetches Stock that are from a Supplier with the given id


Condition which decides if archived Stocks should also be included. 0 => No, 1 => Yes


Condition which filters fetched Stock by only selecting from after the given date


(In these examples, there are 3 total Stocks, Test Stock 2 is Archived, Test Stocks 2 and 3 have a supplier)

1. This example simply gathers the id and name of every non-archived Stock

        'fields' => '["id","name"]'

2. This example will gather the ids and names of all Stock, included Archived, under a Supplier with the ID of 368157

        'fields' => '["id","name"]',
        'all' => '1',
        'supplier_id' => '368157'

3. This example below will fetch the id, names and prices of Stock valid under the following conditions: Their supplier has the ID of 368157, The stock is not Archived, The stock has received changes since the time of 14:47:30 on the 12th of March 2023.

        'fields' => '["id","name","price"]',
        'supplier_id' => '368157',
        'last_edited' => '2023-03-12 14:47:30',
        'all' => '0'


On Success

  1. All non-archive Stock fetched. (Stocks 1 and 3)

[{"id":427418,"name":"Test Stock 1"},{"id":427419,"name":"Test Stock 3"}]
  1. All Stock under a supplier with the ID of 368157. (Stocks 2 and 3)

[{"id":427417,"name":"Test Stock 2"},{"id":427419,"name":"Test Stock 3"}]
  1. The Ids, names and prices of every non-Archived Stock which has been edited since 14:47:30 on the 12th of March 2023 and also has a supplier under the ID of 368157. (Stocks 2 and 3 have been edited since that time, however Stock 2 is Archived, therefore only Stock 3 is fetched)

[{"id":427419,"name":"Test Stock 3","price":"2.0000"}]

Last updated