QuantityClass
Use the REST API to interact with the quantityClass in the application.
You should take into account when making your request
Remember that for some requests, you need to send the authentication token.
Header Parameters
{
"Authorization": "Bearer ...token..."
}
And the query parameters are as follows:
Query Parameters
{
"setting": {
"timezone": "America/Bogota",
"fromAdmin": true,
"appMode": "iadmin",
"authProvider": "local",
"locale": "en"
}
}
Do you want to see the changes made through the API?
After using the API to access products, it's important to update the cache to see the changes.
How to do it:
- Go to the upper-right corner and select the dropdown menu with your username.
- Click on 'Settings.'
- In the 'Actions' section, look for the 'Clear Cache' option.
- Click on 'Clear Cache' to update the information and view the updated products.
Create a quantityClass
Use this endpoint to create a quantityClass. You can only have one default as true
.
- Minimum
- Rest
{
"attributes": {
"value": 6,
"en": { //This depends on the server's language
"title": "Sixpack",
"unit": "sixpack",
}
}
}
{
"attributes": {
"value": 6,
"default": true,
"en": {
"title": "Sixpack",
"unit": "sixpack",
}
}
}
Response
{
"data": {
"id": 1,
"title": "Sixpack",
"default": true,
"unit": "sixpack",
"value": 6
}
}
Modify a quantityClass
Use this endpoint to modify a quantityClass. You can send one or multiple values in the request.
By default, the accepted value is the ID. However, if you want to send another value, you must include it in the Query Parameters
:
{
"filter": {
"field": "title" // Value by which the search will be performed
}
}
- Minimum
- Rest
{
"attributes": {
"en": {
"title": "Unit",
}
}
}
{
"attributes": {
"value": 1,
"default": true,
"en": {
"title": "Unit",
"unit": "und",
}
}
}
Response
{
"data": "Item Updated"
}
Get Multiple quantityClass
Use this endpoint to retrieve multiple quantityClass.
You can filter quantityClass and paginate the results.
Query Parameters
:
- Rest
{
"filter": {
"order": {
"field":"created_at",
"way":"desc"
}
},
"page": 1,
"take": 1
}
Response
{
"data": [
{
"id": 1,
"title": "Sixpack",
"default": true,
"unit": "sixpack",
"value": 6
}
],
"meta": {
"page": {
"total": 1,
"lastPage": 1,
"perPage": "1",
"currentPage": 1
}
}
}
Get a quantityClass
Use this endpoint to retrieve a specific quantityClass.
- Rest
{}
Response
{
"data": {
"id": 1,
"title": "Sixpack",
"default": true,
"unit": "sixpack",
"value": 6
}
}
Delete a quantityClass
Use this endpoint to delete a specific quantityClass.
Send the quantityClass's ID to delete it.
- Rest
{}
Response
{
"data": "Request successful"
}
QuantityClass Fields
Name | Description |
---|---|
value | Type: Double (15,8) Description: This field stores a numeric value of decimal type with a total precision of 15 digits, of which 8 are reserved for the decimal part. It can be used to represent quantity values. |
default | Type: Boolean Description: This field is a boolean value that indicates whether the quantity category is the default one or not. When set to true , it means this category is used as the default. |
title | Type: String Description: This field stores the title or name of the quantity category. |
unit | Type: String Description: This field stores the unit of measurement associated with the quantity category. |