PUT /api/:space/unitofmeasure

Description:

Update a Unit Of Measure by Id. 

The Unit Of Measure that needs to be updated its Id has to exist in the Request body field.

Any Put body Parameters that are excluded in the Request body field will be considered as empty and updated with an empty field

Resource URL:

https://<apphost>.competitionlabs.com/api/<your-space-name>/unitofmeasure

Request headers

KeyValueRequired
X-API-KEY
Your unique API keyYes
Content-Type
application/jsonYes

Request URL parameters

Parameter
Type
Required
Description
space
StringYes

This is the space name which is linked to the account

Put body parameters

Parameter
Type
Required
Description
name
String

Yes

The name of a unit of measure
key
StringYes

The reference to the unit of measure in your system

description
StringOptional

The description of a unit of measure

isoCode
StringOptional

An alphabetical or numerical code to identify a unit of measure

symbol
StringOptionalThe symbol of a unit of measure
multiplier
DoubleYesIs used to multiply the value from the standardised one that is being used
unitOfMeasureType
StringYesA type of unit of measure, eg. Currency, Mass, Time and etc. 
metadata
Array [Object]Optional

A list of MetaData

IdStringYesUnique system identifier of a Unit Of Measure

EXAMPLE

Request
curl
--header "X-API-KEY: <your-api-key>"
--header "Content-Type: application/json"
--request PUT 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" }], "id": "l-TwTW0BBZeE7Tj3bRM4", "translations": {}, "translatableFields": [ "name", "description" ]}'
Response
{
    "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

CodeHTTP StatusDescriptionExample

404Inserting the Id in the Request URL parameter
Error Response 404
{
    "status": 404
}

503Updating without the Id parameter
Error Response 503
{
    "status": 503
}
1001400
  • 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;
Error Response 400
{
    "errors": [
        {
            "message": "Malformed JSON body.",
            "code": 1001,
            "status": 400
        }
    ]
}
1007404
A record with requested id for unit-of-measures was not found
Error Response 404
{
    "errors": [
        {
            "message": "A record with requested id [l-TwTW0BBZeE7Tj3bRM4] for unit-of-measures was not found.",
            "code": 1007,
            "status": 404
        }
    ]
}
1002404
  • The parameter Name can not be empty;
  • The parameter Key can not be empty;
Error Response 404
{
    "errors": [
        {
            "message": "Please enter a name for the unit of measure.",
            "code": 1002,
            "status": 404
        }
    ]
}
Error Response 404
{
    "errors": [
        {
            "message": "Please enter a key for the unit of measure.",
            "code": 1002,
            "status": 404
        }
    ]
}