Xsolla-logo

Create catalog filter ruleServer-sideAdmin

post/v2/project/{project_id}/admin/user/attribute/rule

Create rule for user attributes.

SecuritybasicAuth
Request
path Parameters
project_id
required
integer

Project ID. You can find this parameter in your Publisher Account next to the name of the project.

Example: 44056
Request Body schema: application/json
name
required
string [ 1 .. 255 ] characters ^\S

Readable name of a rule. Used to display a rule in Publisher Account.

is_enabled
required
boolean

If rule is enabled.

required
Array of type = string (objects) or Array of type = date (objects) or Array of type = number (objects)
One of:
[ 1 .. 100 ] items
Array ([ 1 .. 100 ] items)
attribute
required
string [ 1 .. 255 ] characters ^[-_.\\d\\w]+$

User attribute code.

operator
required
string

Type of operation performed by condition. For string attribute type.

Enum: Description
eq

Equals

ne

Not equals

value
required
string <= 255 characters

Condition value which user attribute value will be compared to. Type depends on attribute type.

type
required
string

User attribute type.

Value: "string"
can_be_missing
boolean

Indicates that the condition is met even if attribute is missing from user attributes. Pass true to show the item to users who don't have this attribute. Users who have the attribute, but the value does not match that specified in the condition, will not see the item. false — users who have the attribute, but the value does not match that specified in the condition, or the attribute is missing, will not see the item.

required
Array of objects or objects [ 1 .. 100 ] items
Array ([ 1 .. 100 ] items)
One of:

Items which are shown to a user if their attribute values meet conditions.

item_id
required
number

Item ID.

is_satisfied_for_unauth
boolean

Whether the item is displayed to unauthorized users. If true, the item is displayed to the unauthorized user regardless of catalog display rules. false by default.

Responses
201

Rule was successfully created.

401

Authentication not passed or wrong. Make sure you used authentication or correct credentials.

422

Request validation error.

Request samples
application/json
{
  • "name": "Ork race armor rule",
  • "is_enabled": true,
  • "attribute_conditions": [
    ],
  • "items": [
    ],
  • "is_satisfied_for_unauth": false
}
Response samples
application/json
{
  • "rule_id": 1
}