Products API
To manage your products, you can use the following commands.
Description | Method | URL |
---|---|---|
Get all products | GET | /api/v1/products |
Get one product | GET | /api/v1/products/{id} |
Create new product | POST | /api/v1/products/ |
Update a product | PUT | /api/v1/products/{id} |
Delete a product | DELETE | /api/v1/products/{id} |
All attributes used for products
These are the attributes available in the call to the Products API.
Attribute | Type | Note |
---|---|---|
idrequiredread only | integer | Unique identifier for the product |
code | string(20) | An own defined product code (not displayed on invoices, but it's for your own reference, like an article code) |
name | string | Name of the product shown on the invoice |
price | float | The price of the product with max. 3 decimals |
taxes | integer | Tax percentage. This must be a percentage that's also set in the user his account. |
priceintax | float | The including tax price of the product with max. 3 decimals. When this field is empty, we'll calculate the priceintax automatically based on 'price' and 'taxes'. |
notes | string | Internal notes for a product |
stock | float/boolean | If stock is used, the amount in stock is given, else it will show a false. |
stock_use | boolean | Enable or disable stock features for this product |
Create new product
POST /api/v1/products/
Create a POST with at least the required attributes.
// build the post body we are going to submit
$request->buildPostBody(array(
'code' => 'Soundboard-50S',
'name' => 'Flash Soundboard 50 Samples',
'price' => 39.95,
'taxes' => 21
));
Or as a JSON:
{
"code": "Soundboard-50S",
"name": "Flash Soundboard 50 Samples",
"price": 39.95,
"taxes": 21
}
Update a product
PUT /api/v1/products/{id}
Create a PUT with at least the required attributes and attributes of fields you want to update. Check the example above how to build the PUT body.
Update the stock for a product
PUT /api/v1/products/{id}
With a simple PUT command, the stock can be changed for a product
$request->buildPostBody(array(
'stock' => 24
));
Or as a JSON:
{
"stock": 24
}