Retrieve Units Via HTTP
The Unit object is used by the Quantity data type. To retrieve all active units that exist on the platform, invoke the following operation:
GET https://<host>/<instance>/metadata/units
Response Example
The operation retrieves a JSON map of all units grouped by Quantity, with the associated UUID as the map key. In the following example, a map of related units for Time quantity UUID dd2076b8-c7bf-11e0-b64f-001ec950a80f is retrieved, with the unit UUID used as the map key, and with four related units: hours, minutes, seconds, and milliseconds. The UUID, name, and symbol are retrieved for each unit.
{
"dd2076b8-c7bf-11e0-b64f-001ec950a80f": { <-- Time quantity uuid associated with its map of related units
"dd574d5a-c7bf-11e0-b724-001ec950a80f": {
"symbol": "s",
"name": "seconds",
"uuid": "dd574d5a-c7bf-11e0-b724-001ec950a80f"
},
"baf35ce0-004e-476e-bbd4-96b05b69ee35": {
"symbol": "H",
"name": "hours",
"uuid": "baf35ce0-004e-476e-bbd4-96b05b69ee35"
},
"ca2b8103-4c0f-42c0-bea5-70b43c379dfb": {
"symbol": "ms",
"name": "milliseconds",
"uuid": "ca2b8103-4c0f-42c0-bea5-70b43c379dfb"
},
"2c41278a-b7fc-47eb-a886-70e2c213eb61": {
"symbol": "M",
"name": "minutes",
"uuid": "2c41278a-b7fc-47eb-a886-70e2c213eb61"
}
},
"dd22d91c-c7bf-11e0-b666-001ec950a80f": {
"24870fbd-e4c9-45b7-9124-a478469325f9": {
"symbol": "acre",
"name": "acres",
"uuid": "24870fbd-e4c9-45b7-9124-a478469325f9"
},
"dd78ae96-c7bf-11e0-b7b6-001ec950a80f": {
"symbol": "m2",
"name": "square meters",
"uuid": "dd78ae96-c7bf-11e0-b7b6-001ec950a80f"
},
"96e30dfe-0233-4292-98b9-fc832233034c": {
"symbol": "ft2",
"name": "square feet",
"uuid": "96e30dfe-0233-4292-98b9-fc832233034c"
},
"5495455f-f26b-49a9-aa54-a2c5387e9afc": {
"symbol": "ki2",
"name": "square kilometers",
"uuid": "5495455f-f26b-49a9-aa54-a2c5387e9afc"
},
"2defbd3c-f67a-4002-83ab-accb96f54085": {
"symbol": "mi2",
"name": "square miles",
"uuid": "2defbd3c-f67a-4002-83ab-accb96f54085"
}
}, ....
}
Unit Translation
You can also specify the language parameter to retrieve translated units, for example:
GET https://<host>/<instance>/metadata/units?language=es
Response Example
The same information as for nontranslated units is retrieved, with unit names translated to the specified language, for example, Spanish:
{
"dd2076b8-c7bf-11e0-b64f-001ec950a80f": {
"dd574d5a-c7bf-11e0-b724-001ec950a80f": {
"symbol": "s",
"name": "segundos", <-- translated name
"uuid": "dd574d5a-c7bf-11e0-b724-001ec950a80f"
},
"baf35ce0-004e-476e-bbd4-96b05b69ee35": {
"symbol": "H",
"name": "horas", <-- translated name
"uuid": "baf35ce0-004e-476e-bbd4-96b05b69ee35"
},
"ca2b8103-4c0f-42c0-bea5-70b43c379dfb": {
"symbol": "ms",
"name": "milisegundos", <-- translated name
"uuid": "ca2b8103-4c0f-42c0-bea5-70b43c379dfb"
},
"2c41278a-b7fc-47eb-a886-70e2c213eb61": {
"symbol": "M",
"name": "minutos", <-- translated name
"uuid": "2c41278a-b7fc-47eb-a886-70e2c213eb61"
}
},
"dd22d91c-c7bf-11e0-b666-001ec950a80f": {
"24870fbd-e4c9-45b7-9124-a478469325f9": {
"symbol": "acre",
"name": "acres", <-- translated name
"uuid": "24870fbd-e4c9-45b7-9124-a478469325f9"
},
"dd78ae96-c7bf-11e0-b7b6-001ec950a80f": {
"symbol": "m2",
"name": "metros cuadrados", <-- translated name
"uuid": "dd78ae96-c7bf-11e0-b7b6-001ec950a80f"
}, ...
}, ....
}
For more information:
Was this helpful?