POST /api/:space/account/rule-action-helper

Description:

Create a new Rules action helper.

Resource URL:

https://<apphost>.competitionlabs.com/api/<your-space-name>/account/rule-action-helper

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


Post body parameters

Parameter
Type
Required
Description
name
String

Yes

The name of the Action Helper, for example; Win, Bet etc.
key
StringYes

A unique key that represents an action helper, for example win, bet

description
StringOptional

The description of the action helper for your reference

unitOfMeasureType
StringYesA 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):

ParameterTypeRequiredDescription
keyStringYesIs a unique identifier
valueArray [String]YesThe data that is identified.

EXAMPLE

Request
curl
--header "X-API-KEY: <your-api-key>"
--header "Content-Type: application/json"
--request POST https://app.competitionlabs.com/api/<your-space-name>/account/rule-action-helper
-d '{ "name": "bet", "key": "bet", "description": "bet", "unitOfMeasureType": "Distance", "metadata": [{ "jsonClass": "Metadata", "key": "key", "value": "1" }]}'
Response
{
    "meta": {
        "time": "2020-05-08T08:35:28.260Z"
    },
    "data": {
        "jsonClass": "RuleActionHelper",
        "name": "bet",
        "key": "bet",
        "description": "bet",
        "accountId": "auyNjGYBZ-qHKtWicaaa",
        "system": false,
        "unitOfMeasureType": "Distance",
        "metadata": [],
        "created": "2020-05-08T08:35:28.121+0000",
        "id": "2_ds83EBQIubPjUx1Bn5"
    }
}

ERROR CODES

CodeHTTP StatusDescriptionExample
1021409Duplicate unit of measure found
Error Response 409
{
    "errors": [
        {
            "message": "Duplicate record found",
            "code": 2026,
            "status": 409
        }
    ]
}
1001400
  • Action helper parameter was excluded;
  • Action helper parameter was incorrect;
  • Name parameter was excluded;
  • Key parameter was excluded;
Error Response 400
{
    "errors": [
        {
            "message": "Malformed JSON body.",
            "code": 1001,
            "status": 400
        }
    ]
}

404Adding anything extra to the Resource URL
Error Response 400
{
    "status": 404
}
1002404
  • The parameter Name can not be empty;
  • The parameter Key can not be empty;
Error Response 400
{
    "errors": [
        {
            "message": "Please enter a name for the action helper.",
            "code": 1002,
            "status": 404
        }
    ]
}
Error Response 400
{
    "errors": [
        {
            "message": "Please enter a key for the action helper.",
            "code": 1002,
            "status": 404
        }
    ]
}
</