Products
In products you can store articles and services that you use frequently in your documents.
Products or services always use the latest version of taxes. When modifying a tax, all products in which it applies will be recalculated.
Create a product
This endpoint allows the creation of a new product or service in your application.
HTTP Request
POST/products
Parameters
Name | Type | Description |
---|---|---|
name | String / Required | Product or service name |
quantity | Integer / Required | Quantity |
price | Number up to 2 decimals / Required | Price / Can contain a negative sign as "-100.05" |
description | String / Optional / Maximum 500 characters | Product or service description |
sku | String / Optional | Unique internal product code |
discount | Number up to 2 decimals / Optional / Min:0 Max:100 | Discount percentage applied to the product or service |
business_line_id | Integer / Optional | Business line identifier associated to the product or service |
taxes | Array / Optional | Array of tax identifiers that will be applied to the product or service |
Playload
{
"name": "My product",
"quantity": 2,
"price": 10,
"description": "My product description",
"sku": "my-product-sku",
"discount": 10,
"business_line_id": 1
"taxes": [1,2],
}
201Response
{
"data": {
"id": 120,
"name": "My product",
"description": "My product description",
"sku": "my-product-sku",
"business_line": {
"id": 1,
"name": "Hardware"
},
"quantity": 2,
"price": 10,
"discount": 10,
"subtotal": 20,
"total_discount": 2,
"total_before_taxes": 18,
"taxes": [
{
"id": 1,
"name": "IVA",
"percentage": 21,
"total": 3.78
},
{
"id": 2,
"name": "IRPF",
"percentage": -15,
"total": -2.7
}
],
"total_taxes": 1.08,
"total_with_taxes": 19.08,
"created_at": "2022-09-30T15:30:15+00:00",
"updated_at": "2022-09-30T15:30:15+00:00"
}
}
List products
This endpoint allows the consultation of products and services of your application.
HTTP Request
GET/products
GET Parameters
Name | Type | Description |
---|---|---|
page | Integer / Optional / Min:1 | Page |
per_page | Integer / Optional / Min:1 Max:100 | Items per page |
business_line_id | Integer / Optional | Filter by business line identifier |
search | String / Optional / Min:3 | Search by string of at least 3 characters |
order | String / Optional | Order by a field in ascending or descending, descending by default, in format "{field},desc" or "{field},asc" where {field} can be: id, name, price, quantity, discount, total |
200 Response
{
"data": [
{
"id": 120,
"name": "My product",
"description": "My product description",
"sku": "my-product-sku",
"business_line": {
"id": 1,
"name": "Hardware"
},
"quantity": 2,
"price": 10,
"discount": 10,
"subtotal": 20,
"total_discount": 2,
"total_before_taxes": 18,
"taxes": [
{
"id": 1,
"name": "IVA",
"percentage": 21,
"total": 3.78
},
{
"id": 2,
"name": "IRPF",
"percentage": -15,
"total": -2.7
}
],
"total_taxes": 1.08,
"total_with_taxes": 19.08,
"created_at": "2022-09-30T15:30:15+00:00",
"updated_at": "2022-09-30T15:30:15+00:00"
}
],
"links": {
"first": "http:\/\/api.orzame.com\/v1\/products?page=1",
"last": "http:\/\/api.orzame.com\/v1\/products?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"path": "http:\/\/api.orzame.com\/v1\/products",
"per_page": 100,
"to": 1,
"total": 1
}
}
Get a product
This endpoint allows the consultation of a product of your application.
HTTP Request
GET/products/{id}
200 Response
{
"data": {
"id": 120,
"name": "My product",
"description": "My product description",
"sku": "my-product-sku",
"business_line": {
"id": 1,
"name": "Hardware"
},
"quantity": 2,
"price": 10,
"discount": 10,
"subtotal": 20,
"total_discount": 2,
"total_before_taxes": 18,
"taxes": [
{
"id": 1,
"name": "IVA",
"percentage": 21,
"total": 3.78
},
{
"id": 2,
"name": "IRPF",
"percentage": -15,
"total": -2.7
}
],
"total_taxes": 1.08,
"total_with_taxes": 19.08,
"created_at": "2022-09-30T15:30:15+00:00",
"updated_at": "2022-09-30T15:30:15+00:00"
}
}
Update a product
This endpoint allows the update of a product or service of your application.
HTTP Request
PATCH/products/{id}
Parameters
Name | Type | Description |
---|---|---|
name | String / Optional | Product or service name |
quantity | Integer / Optional | Quantity |
price | Number up to 2 decimals / Optional | Price / Can contain a negative sign as "-100.05" |
description | String / Optional / Maximum 500 characters | Product or service description |
sku | String / Optional | Unique internal product code |
discount | Number up to 2 decimals / Optional / Min:0 Max:100 | Discount percentage applied to the product or service |
business_line_id | Integer / Optional | Business line identifier associated to the product or service. You can send the value `null` to unassign the business line from the product |
taxes | Array / Optional | Array of tax identifiers that will be applied to the product or service. You can send an empty array `[]` to unassign all taxes from the product |
All parameters are optional but at least one parameter with value must be sent.
Playload
{
"name": "My new product",
"description": "My new product description",
"sku": "my-new-product-sku",
"quantity": 1,
"price": 5,
"discount": 0,
"taxes": [],
"business_line_id": null
}
200 Response
{
"data": {
"id": 120,
"name": "My new product",
"description": "My new product description",
"sku": "my-new-product-sku",
"business_line": null,
"quantity": 1,
"price": 5,
"discount": 0,
"subtotal": 5,
"total_discount": 0,
"total_before_taxes": 5,
"taxes": [],
"total_taxes": 0,
"total_with_taxes": 5,
"created_at": "2022-09-30T15:30:15+00:00",
"updated_at": "2022-09-30T16:40:25+00:00"
}
}
Delete a product
This endpoint allows the deletion of a product or service of your application.
HTTP Request
DELETE/products/{id}
204 Response
Response without body.