Set user profile
Set a user's profile information, including basic info (userProfile) and extended attributes (userExtProfile). Basic info covers common fields like name, gender, email, and birthday. Extended attributes are customizable additional fields.
Request method
POST: https://Base URL/v4/user/profile/set
Rate limit: 100 requests per second
Signature required: All server API requests require signature verification. See API request signature.
Request body
The request body is in application/json format and supports the following parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
userId | String | Yes | The user ID. |
userProfile | JSON KV | No | Basic user profile as a JSON object. At least one of userProfile or userExtProfile must be provided. |
userExtProfile | JSON KV | No | Extended user profile as a JSON object. Keys must be alphanumeric, case-sensitive, max 32 characters, and prefixed with ext_. Values must be strings, max 256 characters. Up to 20 key-value pairs by default. You must first add User custom attributes in the console. |
userProfile fields:
| Key | Type | Length/Range | Description |
|---|---|---|---|
uniqueId | String | Max 32 characters | App-specific user ID |
name | String | Max 64 characters | Nickname |
portraitUri | String | Max 1024 characters | Avatar URL |
email | String | Max 128 characters | Email address |
birthday | String | Max 32 characters | Birthday |
gender | Int | 0 = unknown, 1 = male, 2 = female | Gender |
location | String | Max 32 characters | Location |
role | Int | 0–100 | Role |
level | Int | 0–100 | Level |
Request example
HTTP
POST /v4/user/profile/set HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: xxxxxxxxxxxxxxxx
Content-Type: application/json
{
"userId": "u1",
"userProfile": {
"name": "Nick"
},
"userExtProfile": {
"extProfile": "testpro1"
}
}
Response
| Field | Type | Description |
|---|---|---|
code | Number | Status code. 0 indicates success. |
profileKey | String | If code is not 0, returns the specific key that failed. |
Response example
HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"code": 0
}