Skip to main content

WeightClass

Use the REST API to interact with the WeightClass in the application.

You should take into account when making your request
info

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?
info

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.

Clear cache

Create a WeightClass

Use this endpoint to create a WeightClass. You can only have one default as true.

POST/api/icommerce/v3/weight-classes
{
"attributes": {
"value": 1000.00,
"en": { //This depends on the server's language
"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
}
}
PUT/api/icommerce/v3/weight-classes/{criteria}
{
"attributes": {
"en": {
"title": "Ton",
}
}
}
Response
{
"data": "Item Updated"
}

Get Multiple WeightClass

Use this endpoint to retrieve multiple WeightClass.

You can filter WeightClass and paginate the results.

Query Parameters:

GET/api/icommerce/v3/weight-classes
{
"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.

GET/api/icommerce/v3/weight-classes/{criteria}
{}
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.

DELETE/api/icommerce/v3/weight-classes/{id}
{}
Response
{
"data": "Request successful"
}

WeightClass Fields

NameDescription
valueType:
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.
defaultType:
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.
titleType:
String
Description:
This field stores the title or name of the weight category.
unitType:
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.