Skip to main content

LengthClass

Use the REST API to interact with the LengthClass 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 LengthClass

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

POST/api/icommerce/v3/length-classes
{
"attributes": {
"value": 100.00,
"en": { //This depends on the server's language
"title": "Centimeters",
"unit": "cm",
}
}
}
Response
{
"data": {
"id": 1,
"title": "Centimeters",
"default": true,
"unit": "cm",
"value": 100
}
}

Modify a LengthClass

Use this endpoint to modify a LengthClass. 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/length-classes/{criteria}
{
"attributes": {
"en": {
"title": "Decimeter",
}
}
}
Response
{
"data": "Item Updated"
}

Get Multiple LengthClass

Use this endpoint to retrieve multiple LengthClass.

You can filter LengthClass and paginate the results.

Query Parameters:

GET/api/icommerce/v3/length-classes
{
"filter": {
"order": {
"field":"created_at",
"way":"desc"
}
},
"page": 1,
"take": 1
}
Response
{
"data": [
{
"id": 1,
"title": "Centimeters",
"default": true,
"unit": "cm",
"value": 100
}
],
"meta": {
"page": {
"total": 1,
"lastPage": 1,
"perPage": "1",
"currentPage": 1
}
}
}

Get a LengthClass

Use this endpoint to retrieve a specific LengthClass.

GET/api/icommerce/v3/length-classes/{criteria}
{}
Response
{
"data": {
"id": 1,
"title": "Centimeters",
"default": true,
"unit": "cm",
"value": 100
}
}

Delete a LengthClass

Use this endpoint to delete a specific LengthClass.

Send the LengthClass's ID to delete it.

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

LengthClass 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 length values.
defaultType:
Boolean
Description:
This field is a boolean value that indicates whether the length 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 length category.
unitType:
String
Description:
This field stores the unit of measurement associated with the length category. For example, you could use cm for centimeters or in for inches, depending on your needs.