List products
Changed onGET /api/v1/products
Lists products within your company.
You can search and filter the result set using query parameters. These can be chained together allowing fine grained lists to be generated.
Request
- Base URLhttps://demo.invoiceninja.com
- Authnone declared. Required headers: X-API-TOKEN, X-Requested-With
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Query parameters
Includes child relationships in the response, format is comma separated. Check each model for the list of associated includes
Replaces the default response index from data to a user specific string
ie.
?index=new_index
response is wrapped
{
'new_index' : [
.....
]
}
The number of records to return for each request, default is 20
The page number to return for this request (when performing pagination), default is 1
Order the list by choosing a column and direction. Each value uses the form column|asc or column|desc.
Single sort — for example sort=product_key|asc.
Multiple sorts — for example
sort[]=id|desc&sort[]=product_key|asc.
Only real columns on the products table are recognized (for example id, product_key, cost, price). Relationship sorts are not available here. Unsupported keys are ignored.
[ "product_key|asc", "id|desc" ]
Filter the entity based on their status. ie active / archived / deleted. Format is a comma separated string with any of the following options:
- active
- archived
- deleted
GET /api/v1/invoices?status=archived,deleted
Returns only archived and deleted invoices
Filters the entity list by client_id. Suitable when you only want the entities of a specific client.
GET /api/v1/invoices?client_id=AxB7Hjk9
Returns only invoices for the specified client
Filters the entity list by the created at timestamp. Parameter value can be a datetime string or unix timestamp
GET /api/v1/invoices?created_at=2022-01-10
Returns entities created on January 10th, 2022
Filters the entity list by the updated at timestamp. Parameter value can be a datetime string or unix timestamp
GET /api/v1/invoices?updated_at=2022-01-10
Returns entities last updated on January 10th, 2022
Filters the entity list by entities that have been deleted.
GET /api/v1/invoices?is_deleted=true
Returns only soft-deleted entities
Filters the entity list and only returns entities for clients that have not been deleted
GET /api/v1/invoices?filter_deleted_clients=true
Returns only invoices for active (non-deleted) clients
Filters the entity list by an associated vendor
GET /api/v1/purchases?vendor_id=AxB7Hjk9
Returns only purchases for the specified vendor
Filter by product name
Filter by product key
Headers
The API token to be used for authentication
Used to send the XMLHttpRequest header
Response
A list of products
Example response
{
"data": [
{
"id": "eP01N",
"user_id": "n30m4",
"assigned_user_id": "pR0j3",
"project_id": "pR0j3",
"vendor_id": "pR0j3",
"custom_value1": "Custom value 1",
"custom_value2": "Custom value 2",
"custom_value3": "Custom value 3",
"custom_value4": "Custom value 4",
"product_key": "1234",
"notes": "These are some notes about the product.",
"cost": 10,
"price": 20,
"quantity": 5,
"tax_name1": "Tax 1",
"tax_rate1": 10,
"tax_name2": "Tax 2",
"tax_rate2": 5,
"tax_name3": "Tax 3",
"archived_at": 1647604800,
"created_at": 1647604800,
"updated_at": 1647691496,
"tax_id": "1",
"income_account_id": "42"
}
],
"meta": {
"pagination": {
"total": 1,
"count": 1,
"per_page": 1,
"current_page": 1,
"total_pages": 1
}
}
}Changes
- info
for the
queryrequest parametersort, the type was generalized fromstringtoarray
- info
- info
added the optional property
//to the response with the status
- info