Description:

Update Products details in the CompetitionLabs database for a given id.

The Product that needs to be updated its Id has to exist in the Resource URL and Request body field.

Product Ref Id can not be changed after creation

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>/products/<productId>

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
id
StringYesProduct identifier retrieved from GET Products resource

Put 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
StringOptionalProduct 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

idStringYesA unique generated Id of a product

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>/products/j-R4Tm0BBZeE7Tj3MBX7
-d '{ "name": "test product", "productType": "Slot", "description": "test product", "adjustmentFactor": 4.13, "productRefId": "10", "actionAdjustmentFactors": [{"ruleActionHelper": {"name": "bet","key": "bet","description": "bet","system": false,"metadata": [],"id": "8uSuDm8Brwnis6E2gaaa"},"adjustmentFactor": 1.5}], "productGroups": [], "metadata": [{ "jsonClass": "Metadata", "key": "key", "value": "1" }], "id": "j-R4Tm0BBZeE7Tj3MBX7" }'
Response
{
    "data": {
        "jsonClass": "Product",
        "name": "test product",
        "productType": "Slot",
        "accountId": "0sn4DmUBkPH_lz9GgxBM",
        "description": "test product",
        "adjustmentFactor": 4.13,
        "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"
            }
        ],
        "created": "2019-09-20T11:39:22.747+0000",
        "id": "j-R4Tm0BBZeE7Tj3MBX7"
    }
}


ERROR CODES

CodeHTTP StatusDescriptionExample
1001400
  • Unit Of Measure Type parameter was excluded;
  • Product Type parameter was excluded;
  • Name parameter was excluded;
Error Response 400
{
    "errors": [
        {
            "message": "Malformed JSON body.",
            "code": 1001,
            "status": 400
        }
    ]
}
1007404A record with requested id for products was not found
Error Response 404
{
    "errors": [
        {
            "message": "A record with requested id [j-R4Tm0BBZeE7Tj3MBX7a] for products was not found.",
            "code": 1007,
            "status": 404
        }
    ]
}
1002404
  • The parameter Name can not be empty;
  • The parameter Product type can not be empty;
Error Response 404
{
    "errors": [
        {
            "message": "Please enter a name for the product.",
            "code": 1002,
            "status": 404
        }
    ]
}
Error Response 404
{
    "errors": [
        {
            "message": "Please enter a product type for the product.",
            "code": 1002,
            "status": 404
        }
    ]
}

503

Id parameter was excluded;

Error Response 503
{
    "status": 503
}
1009500Adjustment factor parameter was excluded;
Error Response 500
{
    "errors": [
        {
            "message": "None.get | ProductValidators.scala: 110",
            "code": 1009,
            "status": 500
        }
    ]
}