Description:

Create a new Product in the CompetitionLabs database.

Resource URL:

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

Request headers

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

Request URL parameters

Parameter
Type
Required
Description
space
StringYesThis is the space name which is linked to the account

Post body parameters

Parameter
Type
Required
Description
name
String

Yes

Name of the product you want to create

productType
StringYesType of product, eg: Slots, Cards
description
StringOptionalThe description of the product for your reference
adjustmentFactor
DoubleYesAdjustment factor to be applied to incoming event value
productRefId
StringYesProduct id on customer system
actionAdjustmentFactors
Array [Object]Optional

A list of Action Adjustment Factor. It is a default adjustment factor of a pre created action

productGroups
Array [String]OptionalUsed to tag products with taxonomy terms
metadata
Array [Object]Optional

A list of MetaData

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>/products
-d '{ "name": "test product", "productType": "Slot", "description": "test product", "adjustmentFactor": 4.12, "productRefId": "1", "actionAdjustmentFactors": [{"ruleActionHelper": {"name": "bet","key": "bet","description": "bet","system": false,"metadata": [],"id": "8uSuDm8Brwnis6E2gaaa"},"adjustmentFactor": 1.5}], "productGroups": [], "metadata": [{ "jsonClass": "Metadata", "key": "key", "value": "1" }]}'
Response
Response Header:
Status: 200 OK


ERROR CODES

CodeHTTP StatusDescriptionExample
1001400
  • Product type parameter was excluded;
  • Name parameter was excluded;
Error Response 400
{
    "errors": [
        {
            "message": "Malformed JSON body.",
            "code": 1001,
            "status": 400
        }
    ]
}

503Product ref Id parameter was excluded;
Error Response 503
{
    "status": 503
}
1021409Duplicate record found
Error Response 409
{
    "errors": [
        {
            "message": "Duplicate record found.",
            "code": 1021,
            "status": 409
        }
    ]
}
1006406Missing adjustmentFactor
Error Response 406 and 500
{
    "errors": [
        {
            "message": "Multiple products creation failed with errors.",
            "code": 1006,
            "status": 406,
            "children": [
                {
                    "message": "None.get | ProductValidators.scala: 110",
                    "code": 1009,
                    "status": 500
                }
            ]
        }
    ]
}
1009500