Unit Handling Tutorial

How to add a new unit

To add a new measurement unit to your configuration, you need to send a request to the Adding a new unit endpoint.

API Reference
curl -L \
  --request POST \
  --url 'https://api.emporix.io/unit-handling/{tenant}/units' \
  --header 'Content-Language: fr' \
  --header 'Content-Type: application/json' \
  --data '{
    "code": "kg",
    "name": "kilogram",
    "type": "mass",
    "baseUnit": true,
    "symbol": "kg",
    "factor": 1
  }'

How to convert units

You can convert between any measurement units that share the same base unit, such as kilograms to grams, or centimeters to meters.

To convert between units, you need to send a request to the Converting units endpoint.

API Reference
curl -L \
  --request PUT \
  --url 'https://api.emporix.io/unit-handling/{tenant}/units/convert-unit-commands' \
  --header 'Content-Type: application/json' \
  --data '{
    "commandUuid": "text",
    "input": {
      "sourceUnitAmount": 100,
      "sourceUnit": "g",
      "targetUnit": "kg"
    }
  }'

Last updated

Was this helpful?