Unit conversion
Convert Units
Calculates conversion factor for the given pair of units.
Authorizations
Path parameters
tenantstringRequiredExample:
The tenant name.
testtenant
Body
commandUuidstringOptional
Responses
201
The factor has been successfully calculated.
application/json
400
The conversion factor cannot be fetched due to wrong parameters.
application/json
401
Given request is unauthorized - the authorization token is invalid or has expired.
Details will be provided in the response payload.
application/json
404
At least one of the specified units cannot be found.
application/json
500
Unexpected server error
application/json
put
PUT /unit-handling/{tenant}/units/conversion-factor-commands HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 88
{
"commandUuid": "text",
"input": {
"sourceUnitAmount": 1,
"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.
Authorizations
Path parameters
tenantstringRequiredExample:
The tenant name.
testtenant
Body
commandUuidstringOptional
Responses
201
The unit has ben successfully converted.
application/json
400
The unit cannot be converted due to wrong parameters.
application/json
401
Given request is unauthorized - the authorization token is invalid or has expired.
Details will be provided in the response payload.
application/json
404
At least one of the specified units cannot be found.
application/json
500
Unexpected server error
application/json
put
PUT /unit-handling/{tenant}/units/convert-unit-commands HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 90
{
"commandUuid": "text",
"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"
}
}
Was this helpful?