Xsolla-logo
  • 文档
  • 创建帐户

从服务器更新用户属性

post/attributes/users/{user_id}/update

Updates and creates user’s attributes.

Notice
Rate limits for server-side methods are applied to this method.

SecurityAttributesServer
Request
path Parameters
user_id
required
string <uuid>

用户ID。可以在发布商帐户 > 登录管理器设置 > 用户 > 用户名/ID 中找到它。

Request Body schema: application/json
publisher_id
required
integer or null

请求所针对的商家ID。请求授权时需要。

Array of objects

指定游戏的属性列表。 要添加不存在的属性,请将此属性设置为key参数。 要更新属性的value,请指定其key参数并设置新的value。可以一次更改多个属性。

Array
key
required
string <= 256 characters [A-Za-z0-9_]+

用于标识用户属性的属性名称。对于每个用户必须是唯一的。

value
required
string <= 256 characters

用户属性的值。

attr_type
string
Default: "client"

Definition of user’s access level to service attributes:

  • client - A user-editable attribute. The values for this type of attributes are entered by a user or specified according to the in-game logics on the client side. For example, the name and character stats, game difficulty level, etc.
  • server - A read-only attribute. The values for this type of attributes are entered and edited on the server side of your application. We recommend that you use them for configuration of game character stats or user parameters that shouldn’t change regularly. For example, chance to get a bonus, game character key parameters, user categories, etc.
Enum: "client" "server"
data_type
string or null

属性的数据类型

Enum: "string" "number" "integer" "boolean"
description
string or null

JSON机制中的属性描述。

format
string or null

JSON机制中的属性格式。可以是date-timedatetimedurationemailuriuuid或JSON机制规范中的其他格式

permission
string or null

定义用户对其他用户属性的访问级别。

Enum: "public" "private"
publisher_project_id
integer

发布商帐户中的项目ID,要为其更新指定属性的值。如果不指定,则方法只更新用于所有游戏的通用属性。

removing_keys
Array of strings

要删除的属性列表。如果在attributes参数中指定了相同的属性,则不会被删除。

Responses
204

无内容

400

错误的请求

403

被禁止

422

无法处理的实体

429

请求过多

Request samples
application/json
{
  • "attributes": [
    ],
  • "publisher_id": 0,
  • "publisher_project_id": 0,
  • "removing_keys": [
    ]
}
Response samples
{
  • "error": {
    }
}