Xsolla-logo
  • 文档
  • 创建帐户

创建目录筛选规则

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

创建用户属性的规则。

SecuritybasicAuth
Request
path Parameters
project_id
required
integer

项目编号。您可以在您的发布商帐户项目名称旁边。

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

规则的可读名称。用于在发布商帐户中显示规则。

is_enabled
required
boolean

如果已启用规则。

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]+$

用户属性代码。

operator
required
string

按条件执行的操作类型。用于string属性类型。

Enum: Description
eq

等于

ne

不等于

value
required
string <= 255 characters

与用户属性值进行比较的条件值。类型取决于属性类型。

type
required
string

用户属性类型。

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:

属性值满足条件的情况下向用户显示的商品。

item_id
required
number

商品ID。

is_satisfied_for_unauth
boolean

是否向未经授权的用户显示该商品。如为true,无论目录显示规则如何,该商品都会向未经授权的用户显示。默认为false

Responses
201

规则已成功创建。

401

身份认证未通过或错误。请确保您使用了身份认证或正确的凭据。

422

请求验证错误。

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