Download OpenAPI specification:Download
Define and manage various unit systems, including metric, imperial, USC, and custom in which your products may be sold.
Key Features:
Key Benefits:
Creates a new unit. After successful creation, unit will be visible and executable for other parts of the system after 5 minutes.
Content-Language
is set to *
the request body payload should contain localized fields not as a string,
but as a map in format: key:value
, where the key
is the language code and value
is the translation.Please see the example (Unit with name as a map) in Request body section.
unithandling.unit_manage
The unit has been successfully created.
Example response
Given request is unauthorized - the authorization token is invalid or has expired.
Details will be provided in the response payload.
Given authorization scopes are not sufficient and do not match scopes required by the endpoint.
The unit already exists.
Unexpected server error
{- "code": "kg",
- "name": "kilogram",
- "type": "mass",
- "baseUnit": true,
- "symbol": "kg",
- "factor": 1
}
{- "code": "string"
}
Retrieves a list of units conforming with the given filters. Supports sorting and paging.
Accept-Language
is set to *
each internationalized field is returned as a map that contains all of translations in a format of key:value
pairs, where the key
is the language code and value
is the translation.Accept-Language
can contain the priority list of languages which should be returned. Always one language is returned as a single string field. Example: 'fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7'Accept-Language
header is empty default language defined in the Configuration service
is taken.Please, see the examples below.
The units were retrieved successfully.
Example response
Given request is unauthorized - the authorization token is invalid or has expired.
Details will be provided in the response payload.
Unexpected server error
list containing localized units
[- {
- "code": "g",
- "name": "gram",
- "type": "mass",
- "baseUnit": true,
- "factor": 1,
- "metadata": {
- "version": 2,
- "createdAt": "2021-10-25T10:59:24.385Z",
- "modifiedAt": "2021-10-25T10:59:24.385Z"
}
}, - {
- "code": "ug",
- "name": "microgram",
- "type": "mass",
- "symbol": "µg",
- "baseUnit": false,
- "factor": 0.000001,
- "metadata": {
- "version": 1,
- "createdAt": "2021-10-25T10:59:24.385Z",
- "modifiedAt": "2021-10-25T10:59:24.385Z"
}
}
]
Deletes the units with the given codes. After successful deletion, units will not be visible and executable for other parts of the system after 5 minutes.
["g", "kg", "dag", "test"]
unithandling.unit_manage
The units have been successfully deleted.
The units cannot be deleted due to no payload.
Given request is unauthorized - the authorization token is invalid or has expired.
Details will be provided in the response payload.
Given authorization scopes are not sufficient and do not match scopes required by the endpoint.
Unexpected server error
{- "message": "Bad Request",
- "_links": {
- "self": {
- "href": "/testtenant/units",
- "templated": false
}
}, - "_embedded": {
- "errors": [
- {
- "message": "Required Body [unitCodes] not specified",
- "path": "/unitCodes"
}
]
}
}
Retrieves the unit with the given code.
Accept-Language
is set to *
each internationalized field is returned as a map that contains all of translations in a format of key:value
pairs, where the key
is the language code and value
is the translation.Accept-Language
can contain the priority list of languages which should be returned. Always one language is returned as a single string field.Accept-Language
header is empty default language defined in the Configuration service
is taken.Please, see the examples below.
Returns the given unit.
Example response
Given request is unauthorized - the authorization token is invalid or has expired.
Details will be provided in the response payload.
The unit has not been found.
Unexpected server error
{- "code": "kg",
- "name": "kilogram",
- "type": "mass",
- "baseUnit": true,
- "factor": 1,
- "metadata": {
- "version": 1
}
}
Deletes the unit with the given code. After successful deletion, unit will not be visible and executable for other parts of the system after 5 minutes.
unithandling.unit_manage
The unit has been successfully deleted.
Given request is unauthorized - the authorization token is invalid or has expired.
Details will be provided in the response payload.
Given authorization scopes are not sufficient and do not match scopes required by the endpoint.
The unit has not been found.
Unexpected server error
{- "fault": {
- "faultstring": "Access Token expired",
- "detail": {
- "errorcode": "keymanagement.service.access_token_expired"
}
}
}
Updates an existing unit. Optimistic locking is applied to prevent update races when unit in the payload contains the optional version field. After successful update, unit will be visible and executable for other parts of the system after 5 minutes.
Content-Language
is set to *
the request body payload should contain localized fields not as a string,
but as a map in format: key:value
, where the key
is the language code and value
is the translation.Please see the example (Unit with name as a map) in Request body section.
unithandling.unit_manage
The unit has been updated successfully.
The unit cannot be updated due to an incorrect payload.
Given request is unauthorized - the authorization token is invalid or has expired.
Details will be provided in the response payload.
Given authorization scopes are not sufficient and do not match scopes required by the endpoint.
The unit has not been found.
Unexpected server error
{- "code": "kg",
- "name": "kilogram",
- "type": "mass",
- "baseUnit": true,
- "factor": 1,
- "metadata": {
- "version": 1
}
}
{- "code": 400,
- "status": "Bad Request",
- "message": "There is a validation error. Please check the details.",
- "details": [
- "The unit name must be specified"
]
}
Calculates conversion factor for the given pair of units.
The factor has been successfully calculated.
The conversion factor cannot be fetched due to wrong parameters.
Given request is unauthorized - the authorization token is invalid or has expired.
Details will be provided in the response payload.
At least one of the specified units cannot be found.
Unexpected server error
{- "commandUuid": "string",
- "input": {
- "sourceUnitAmount": 0,
- "sourceUnit": "g",
- "targetUnit": "kg"
}
}
{- "commandUuid": "e948a54d-ffeb-405a-9614-c68406274554,",
- "input": {
- "sourceUnit": "us-fl-oz,",
- "targetUnit": "cl"
}, - "output": {
- "conversionFactor": 2.95735296
}
}
Converts the source unit to a target unit.
The unit has ben successfully converted.
The unit cannot be converted due to wrong parameters.
Given request is unauthorized - the authorization token is invalid or has expired.
Details will be provided in the response payload.
At least one of the specified units cannot be found.
Unexpected server error
{- "commandUuid": "string",
- "input": {
- "sourceUnitAmount": 100,
- "sourceUnit": "g",
- "targetUnit": "kg"
}
}
{- "commandUuid": "83ddc478-89d7-48e1-8b6c-527f4c67fb56",
- "input": {
- "sourceUnitAmount": 100,
- "sourceUnit": "us-fl-oz",
- "targetUnit": "cl"
}, - "output": {
- "targetUnitAmount": 295.735296,
- "targetUnit": "cl"
}
}
Retrieves list of all unit types present in the database.
All unit types retrieved successfully.
Given request is unauthorized - the authorization token is invalid or has expired.
Details will be provided in the response payload.
Unexpected server error
[- "length",
- "mass",
- "quantity",
- "volume"
]