PUT /api/:space/account/reward-types/:id

Description:

Update a Reward type by Id. 

The Reward type 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>/account/reward-types/<Id>

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 reward type
key
StringYes

The reference to the reward type in your system

description
StringOptional

The description of a unit of measure

system
BooleanOptional

Default false. True states that the reward type can be deleted

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 Reward type

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", "system": false, "unitOfMeasureType": "Distance", "metadata": [], "id": "0iyu13MBDp41zK05CmQy"}'
Response
{
    "time": "2020-08-10T09:29:07.012Z",
    "data": {
        "jsonClass": "RewardType",
        "name": "test",
        "key": "test",
        "description": "test",
        "accountId": "0sn4DmUBkPH_lz9Ggasd",
        "system": false,
        "unitOfMeasureType": "Distance",
        "metadata": [],
        "created": "2020-08-10T09:22:54.130+0000",
        "id": "0iyu13MBDp41zK05CmQy"
    }
}

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
  • Reward Type parameter was excluded;
  • Reward 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 reward type 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
        }
    ]
}