Here you can find all the Rule sets combinations for an Achievement creation POST via API. The Achievement has to have at least 1 rule sets with an actions that is award this achievement.

This page is for reference only to display all the possible rules combinations.

You can not create an achievement only with rules parameters. All other POST body parameters that are required for an achievement creation must exist.

You can find the rest of the POST body parameters needed to create an achievement here

Resource URL:

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

Request headers

Key
Value
Required
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 ruleSets parameter

ParameterTypeRequiredDescription
ruleSets













Array [Object]












Yes












A list of RuleSetsTypeRequiredDescription
priority
IntegerYesA value to display the rules in order
scope
StringYesWhat model it belongs to for example contest or achievement
onMatchThen
StringNo

Only Required when "Custom points" action is selected in a contest creation

onMatchConstant
StringNo

Only Required when "Custom points" action is selected in a contest creation

action
StringYes

Displays the rule set. 

Available actions
Award this achievement
	"action": "member.achievement"
conditions







Array [Object]






Yes






MainConditionSet model.

TypeRequiredDescription

matchCondition

Enum

  • All
  • Any
YesWhether the rules must all evaluate as True or False or at least one of the rules must be True or False to satisfy the rule
mustEvaluateTo
BooleanYesThe value the rule(s) must evaluate to for the rule to be satisfied
rules




Array [Object]



Yes



MainRule model.

TypeRequiredDescription
fact
StringYes

Displays the facts of the rule. 

Available fact
The count of events where the nested condition(s) evaluate to TRUE for the event
	"fact": "event.count"

The average source value for events where the nested condition(s) evaluate to TRUE for the event
	"fact": "avg.event.source.value"

The sum of all the source values for events where the nested condition(s) evaluate to TRUE for the event
	"fact": "sum.event.source.value"

The largest source value in events where the nested condition(s) evaluate to TRUE for the event
	"fact": "max.event.source.value"

The smallest source value in events where the nested condition(s) evaluate to TRUE for the event
	"fact": "min.event.source.value"

The average points for all matching events
	"fact": "avg.event.points.value"

The sum of all the points for events where the nested condition(s) evaluate to TRUE for the event
	"fact": "sum.event.points.value"

The largest point value for all matching events
	"fact": "max.event.points.value"

The smallest point in events where the nested condition(s) evaluate to TRUE for the event
	"fact": "min.event.points.value"
operator
StringYes

Part of the rule which operates the fact ex. is, more than, less than etc.

Available operator
For "The count of events where the nested condition(s) evaluate to TRUE for the event"
	is equal to or more than
	"operator": ">="

	is more than
	"operator": ">"

	is
	operator": "=="

	is less than or equal to
	operator": "<="

	is less than
	operator": "<"

For "The average source value for events where the nested condition(s) evaluate to TRUE for the event"
	is equal to or more than
	"operator": ">="

	is more than
	"operator": ">"

	is
	operator": "=="

	is less than or equal to
	operator": "<="

	is less than
	operator": "<"

For "The sum of all the source values for events where the nested condition(s) evaluate to TRUE for the event"
	is equal to or more than
	"operator": ">="

	is more than
	"operator": ">"

	is
	operator": "=="

	is less than or equal to
	operator": "<="

	is less than
	operator": "<"

For "The largest source value in events where the nested condition(s) evaluate to TRUE for the event"
	is equal to or more than
	"operator": ">="

	is more than
	"operator": ">"

	is
	operator": "=="

	is less than or equal to
	operator": "<="

	is less than
	operator": "<"

For "The smallest source value in events where the nested condition(s) evaluate to TRUE for the event"
	is equal to or more than
	"operator": ">="

	is more than
	"operator": ">"

	is
	operator": "=="

	is less than or equal to
	operator": "<="

	is less than
	operator": "<"

For "The average points for all matching events"
	is equal to or more than
	"operator": ">="

	is more than
	"operator": ">"

	is
	operator": "=="

	is less than or equal to
	operator": "<="

	is less than
	operator": "<"

For "The sum of all the points for events where the nested condition(s) evaluate to TRUE for the event"
	is equal to or more than
	"operator": ">="

	is more than
	"operator": ">"

	is
	operator": "=="

	is less than or equal to
	operator": "<="

	is less than
	operator": "<"

For "The largest point value for all matching events"
	is equal to or more than
	"operator": ">="

	is more than
	"operator": ">"

	is
	operator": "=="

	is less than or equal to
	operator": "<="

	is less than
	operator": "<"

For "The smallest point in events where the nested condition(s) evaluate to TRUE for the event"
	is equal to or more than
	"operator": ">="

	is more than
	"operator": ">"

	is
	operator": "=="

	is less than or equal to
	operator": "<="

	is less than
	operator": "<"
constant
StringYes

A rules value that defines the fact ex. if the fact is "the action" then the constant is "win". All constants are variables.

subConditions
Array [Object]Optional

subConditionSet model. Works the same as Main condition set model.

Continue below

ParameterTypeRequiredDescription
subConditions













Array [Object]












Yes












subConditionSet model.TypeRequiredDescription
matchCondition

Enum

  • All
  • Any
YesWhether the rules must all evaluate as True or False or at least one of the rules must be True or False to satisfy the rule
mustEvaluateTo
BooleanYesThe value the rule(s) must evaluate to for the rule to be satisfied
subRules







Array [Object]






Yes






SubRule model

TypeRequiredDescription

fact

String

Yes

Valid rules facts, ex. the action, the product, the sum of events etc.

Available fact For "The count of events where the nested condition(s) evaluate to TRUE for the event"
The external event reference id
	"fact": "event.external.id"

The action is example is BET, WIN and so on
	"fact": "event.action.type"

The product or the games
	"fact": "event.product.id"

The event source value
	"fact": "event.source.value"

The event points value
	"fact": "event.points.value"

The event transaction timeStamp in minutes
	"fact": "event.transaction.timeStamp"
Available fact For "The average source value for events where the nested condition(s) evaluate to TRUE for the event"
The external event reference id
	"fact": "event.external.id"

The action is example is BET, WIN and so on
	"fact": "event.action.type"

The product or the games
	"fact": "event.product.id"

The event source value
	"fact": "event.source.value"

The event points value
	"fact": "event.points.value"

The event transaction timeStamp in minutes
	"fact": "event.transaction.timeStamp"
Available fact For "The sum of all the source values for events where the nested condition(s) evaluate to TRUE for the event"
The external event reference id
	"fact": "event.external.id"

The action is example is BET, WIN and so on
	"fact": "event.action.type"

The product or the games
	"fact": "event.product.id"

The event source value
	"fact": "event.source.value"

The event points value
	"fact": "event.points.value"

The event transaction timeStamp in minutes
	"fact": "event.transaction.timeStamp"
Available fact For "The largest source value in events where the nested condition(s) evaluate to TRUE for the event"
The external event reference id
	"fact": "event.external.id"

The action is example is BET, WIN and so on
	"fact": "event.action.type"

The product or the games
	"fact": "event.product.id"

The event source value
	"fact": "event.source.value"

The event points value
	"fact": "event.points.value"

The event transaction timeStamp in minutes
	"fact": "event.transaction.timeStamp"
Available fact For "The smallest source value in events where the nested condition(s) evaluate to TRUE for the event"
The external event reference id
	"fact": "event.external.id"

The action is example is BET, WIN and so on
	"fact": "event.action.type"

The product or the games
	"fact": "event.product.id"

The event source value
	"fact": "event.source.value"

The event points value
	"fact": "event.points.value"

The event transaction timeStamp in minutes
	"fact": "event.transaction.timeStamp"
Available fact For "The average points for all matching events"
The external event reference id
	"fact": "event.external.id"

The action is example is BET, WIN and so on
	"fact": "event.action.type"

The product or the games
	"fact": "event.product.id"

The event source value
	"fact": "event.source.value"

The event points value
	"fact": "event.points.value"

The event transaction timeStamp in minutes
	"fact": "event.transaction.timeStamp"
Available fact For "The sum of all the points for events where the nested condition(s) evaluate to TRUE for the event"
The external event reference id
	"fact": "event.external.id"

The action is example is BET, WIN and so on
	"fact": "event.action.type"

The product or the games
	"fact": "event.product.id"

The event source value
	"fact": "event.source.value"

The event points value
	"fact": "event.points.value"

The event transaction timeStamp in minutes
	"fact": "event.transaction.timeStamp"
Available fact For "The largest point value for all matching events"
The external event reference id
	"fact": "event.external.id"

The action is example is BET, WIN and so on
	"fact": "event.action.type"

The product or the games
	"fact": "event.product.id"

The event source value
	"fact": "event.source.value"

The event points value
	"fact": "event.points.value"

The event transaction timeStamp in minutes
	"fact": "event.transaction.timeStamp"
Available fact For "The smallest point in events where the nested condition(s) evaluate to TRUE for the event"
The external event reference id
	"fact": "event.external.id"

The action is example is BET, WIN and so on
	"fact": "event.action.type"

The product or the games
	"fact": "event.product.id"

The event source value
	"fact": "event.source.value"

The event points value
	"fact": "event.points.value"

The event transaction timeStamp in minutes
	"fact": "event.transaction.timeStamp"
operator
StringYes

Part of the rule which operates the fact ex. is, more than, less than etc.

Available operators
For "The external event reference id"
	is
	"operator": "=="

For "The action"
	is
	"operator": "=="

For "The product"
	is
	"operator": "=="

For "The event source value"
	is equal to or more than
	"operator": ">="

	is more than
	"operator": ">"

	is equal to
	operator": "=="

	is less than or equal to
	operator": "<="

	is less than
	operator": "<"

For "The event points value"
	is equal to or more than
	"operator": ">="

	is more than
	"operator": ">"

	is equal to
	operator": "=="

	is less than or equal to
	operator": "<="

	is less than
	operator": "<"

For "The event transaction timeStamp in minutes"
	is less than
	operator": "<"

	is less than or equal to
	operator": "<="
constant
StringYes

A rules value that defines the fact ex. if the fact is "the action" then the constant is "win"

EXAMPLE

Json ruleSets example
		"ruleSets": [
            {
                "jsonClass": "RuleSet",
                "priority": 1,
                "scope": "achievement",
                "action": "member.achievement",
                "conditions": [
                    {
                        "jsonClass": "MainConditionSet",
                        "matchCondition": "All",
                        "mustEvaluateTo": true,
                        "rules": [
                            {
                                "jsonClass": "MainRule",
                                "fact": "event.count",
                                "operator": ">=",
                                "constant": "5",
                                "subConditions": [
                                    {
                                        "jsonClass": "SubConditionSet",
                                        "matchCondition": "All",
                                        "mustEvaluateTo": true,
                                        "subRules": [
                                            {
                                                "jsonClass": "SubRule",
                                                "fact": "event.action.type",
                                                "operator": "==",
                                                "constant": "bet"
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ],
Request for a complete achievement creation
curl
--header "X-API-KEY: <your-api-key>"
--header "Content-Type: application/json"
--request POST https://app.competitionlabs.com/api/<your-space-name>/achievements
-d '{ "rewards": [],"achievement": { "jsonClass": "Achievement","name": "test3","description": "","initialState": 0,"icon": "IOOrTGgBJK8hOXbLqdcV","ruleSets": [{"jsonClass": "RuleSet","priority": 1,"scope": "achievement","action": "member.achievement","conditions": [{"jsonClass": "MainConditionSet","matchCondition": "All","mustEvaluateTo": true,"rules": [{"jsonClass": "MainRule","fact": "event.count","operator": ">=","constant": "5","id": "GOZjIW0BzPEHrdkQtkCd","subConditions": [{"jsonClass": "SubConditionSet","matchCondition": "All","mustEvaluateTo": true,"subRules": [{"jsonClass": "SubRule","fact": "event.external.id","operator": "==", "constant": "bet"}]}]}]}]}],"deprecated": false,"dependantOn": [],"minimumShouldMatch": 0,"scheduling": {"scheduleType": "Once","every": [],"startDate": "2019-09-11T17:33:00.000+00:00","onlyAggregateOnActiveDays": false},"achievementLiveStatus": "Live", "category": [], "memberGroups": [], "metadata": [], "translations": {}, "translatableFields": [ "name", "description"]}}'
Response of a complete achievement creation
{
    "data": {
        "jsonClass": "Achievement",
        "name": "Test",
        "accountId": "0sn4DmUBkPH_lz9GgxBM",
        "description": "",
        "initialState": 0,
        "icon": "RIaekmsBbFCgxOIxCpQv",
        "ruleSets": [
            {
                "jsonClass": "RuleSet",
                "priority": 1,
                "scope": "achievement",
                "action": "member.achievement",
                "conditions": [
                    {
                        "jsonClass": "MainConditionSet",
                        "matchCondition": "All",
                        "mustEvaluateTo": true,
                        "rules": [
                            {
                                "jsonClass": "MainRule",
                                "fact": "event.count",
                                "operator": ">=",
                                "constant": "5",
                                "subConditions": [
                                    {
                                        "jsonClass": "SubConditionSet",
                                        "matchCondition": "All",
                                        "mustEvaluateTo": true,
                                        "subRules": [
                                            {
                                                "jsonClass": "SubRule",
                                                "fact": "event.action.type",
                                                "operator": "==",
                                                "constant": "bet"
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ],
        "deprecated": false,
        "dependantOn": [],
        "minimumShouldMatch": 0,
        "scheduling": {
            "scheduleType": "Once",
            "scheduleOccurrencesLimit": 1,
            "every": [],
            "startDate": "2019-10-31T09:34:00.000+0000",
            "onlyAggregateOnActiveDays": false
        },
        "achievementLiveStatus": "Live",
        "category": [],
        "memberGroups": [],
        "metadata": [],
        "created": "2019-10-31T09:35:02.773+0000",
        "id": "4vorIW4ByrynV-OgGNp1",
        "translations": {},
        "translatableFields": [
            "name",
            "description"
        ]
    }
}