Description:
Create a new unit of measure.
Resource URL:
https://<apphost>.competitionlabs.com/api/<your-space-name>/unitofmeasure
Key | Value | Required |
---|
X-API-KEY | Your unique API key | Yes |
Content-Type | application/json | Yes |
Request URL parameters
| | | |
---|
space | String | Yes | This is the space name which is linked to the account |
Post body parameters
key | String | Yes | The reference to the unit of measure in your system |
description | String | Optional | The description of a unit of measure |
isoCode | String | Optional | An alphabetical or numerical code to identify a unit of measure |
symbol | String | Optional | The symbol of a unit of measure |
multiplier | Double | Yes | Is used to multiply the value from the standardised one that is being used |
unitOfMeasureType | String | Yes | A type of unit of measure, eg. Currency, Mass, Time and etc. |
metadata | Array [Object] | Optional | A list of MetaData. An object of key value pair (KVP): |
Parameter | Type | Required | Description |
---|
key | String | Yes | Is a unique identifier |
value | Array [String] | Yes | The data that is identified. |
EXAMPLE
curl
--header "X-API-KEY: <your-api-key>"
--header "Content-Type: application/json"
--request POST https://app.competitionlabs.com/api/<your-space-name>/unitofmeasure
-d '{ "name": "test", "key": "test", "description": "test", "isoCode": "T", "symbol": "T", "multiplier": 1.0, "unitOfMeasureType": "Distance", "metadata": [{ "jsonClass": "Metadata", "key": "key", "value": "1" }], "translations": {}, "translatableFields": [ "name", "description" ]}'
{
"data": {
"jsonClass": "UnitOfMeasure",
"name": "test",
"key": "test",
"description": "test",
"isoCode": "T",
"symbol": "T",
"multiplier": 1.0,
"unitOfMeasureType": "Distance",
"metadata": [
{
"jsonClass": "Metadata",
"key": "key",
"value": "1"
}
],
"accountId": "0sn4DmUBkPH_lz9GgxBM",
"created": "2019-09-20T09:11:05.270+0000",
"id": "l-TwTW0BBZeE7Tj3bRM4",
"translations": {},
"translatableFields": [
"name",
"description"
]
}
}
ERROR CODES
Code | HTTP Status | Description | Example |
---|
1021 | 409 | Duplicate unit of measure found |
{
"errors": [
{
"message": "Duplicate record found",
"code": 2026,
"status": 409
}
]
}
|
1001 | 400 | Unit Of Measure Type parameter was excluded;Unit Of Measure Type parameter was incorrect;Multiplier parameter was excluded;Name parameter was excluded;Key parameter was excluded;
|
{
"errors": [
{
"message": "Malformed JSON body.",
"code": 1001,
"status": 400
}
]
}
|
| 404 | Adding anything extra to the Resource URL | |
1002 | 404 | - The parameter
Name can not be empty; - The parameter
Key can not be empty;
|
{
"errors": [
{
"message": "Please enter a name for the unit of measure.",
"code": 1002,
"status": 404
}
]
}
{
"errors": [
{
"message": "Please enter a key for the unit of measure.",
"code": 1002,
"status": 404
}
]
}
|