WeightClass
Use the REST API to interact with the WeightClass 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 WeightClass
Use this endpoint to create a WeightClass. You can only have one default as true
.
- Minimum
- Rest
{
"attributes": {
"value": 1000.00,
"en": { //This depends on the server's language
"title": "Kilogram",
"unit": "Kg",
}
}
}
{
"attributes": {
"value": 1000,
"default": true,
"en": {
"title": "Kilogram",
"unit": "Kg",
}
}
}
Response
{
"data": {
"id": 1,
"title": "Kilogram",
"default": true,
"unit": "Kg",
"value": 1000
}
}
Modify a WeightClass
Use this endpoint to modify a WeightClass. 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": "Ton",
}
}
}
{
"attributes": {
"value": 10,
"default": true,
"en": {
"title": "Ton",
"unit": "Tn",
}
}
}
Response
{
"data": "Item Updated"
}
Get Multiple WeightClass
Use this endpoint to retrieve multiple WeightClass.
You can filter WeightClass and paginate the results.
Query Parameters
:
- Rest
{
"filter": {
"order": {
"field":"created_at",
"way":"desc"
}
},
"page": 1,
"take": 1
}
Response
{
"data": [
{
"id": 1,
"title": "Kilogram",
"default": true,
"unit": "Kg",
"value": 1000
}
],
"meta": {
"page": {
"total": 1,
"lastPage": 1,
"perPage": "1",
"currentPage": 1
}
}
}
Get a WeightClass
Use this endpoint to retrieve a specific WeightClass.
- Rest
{}
Response
{
"data": {
"id": 1,
"title": "Kilogram",
"default": true,
"unit": "Kg",
"value": 1000
}
}
Delete a WeightClass
Use this endpoint to delete a specific WeightClass.
Send the WeightClass's ID to delete it.
- Rest
{}
Response
{
"data": "Request successful"
}
WeightClass 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 weight values. |
default | Type: Boolean Description: This field is a boolean value that indicates whether the weight 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 weight category. |
unit | Type: String Description: This field stores the unit of measurement associated with the weight category. For example, you could use kg for kilograms or lb for pounds, depending on your needs. |