Update a Specific User
This endpoint updates the profile of a user identified by {id}. A user can only update their personal data.
info
username field must be unique and valid (valid characters are: a-z A-Z 0-9 _-).
info
If the request will update the avatar or the cover the 'Content-Type' request header must be set as 'multipart/form-data', otherwise it can be 'application/x-www-form-urlencoded'.
info
This operation requires authentication.
HTTP Request
PUT /api/v2/user/{id}/
Parameters
| Name | In | Type | Required | Description | 
|---|---|---|---|---|
| id | path | string | true | A unique integer value identifying this user. | 
| body | body | User | true | The request body(user params to update) | 
Example Body Parameters
- JSON
{
  "username": "string",
  "real_name": "string",
  "bio": "string",
  "location": "string",
  "location_lat_lng": "string",
  "position_lat_lng": "string",
  "date_of_birth": "string",
  "description": "string",
  "gender": "string",
  "avatar": "string",
  "cover": "string",
  "website": "string"
}
Example Request
- JavaScript
- Bash
const inputBody = '{
  "username": "string",
  "real_name": "string",
  "bio": "string",
  "location": "string",
  "location_lat_lng": "string",
  "position_lat_lng": "string",
  "date_of_birth": "string",
  "description": "string",
  "gender": "string",
  "avatar": "string",
  "cover": "string",
  "website": "string"
}';
const headers = {
  'Content-Type': 'multipart/form-data',
  'Accept':'application/json',
  'Authorization: Bearer <token>'
};
fetch('/api/v2/user/{id}/',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
# You can also use wget
curl -X PUT /api/v2/user/{id}/ \
  -H 'Content-Type':'multipart/form-data'
  -H 'Accept: application/json'
  -H 'Authorization: Bearer <token>'
Responses
| Status | Meaning | Description | Schema | 
|---|---|---|---|
| 200 | OK | Response status code | User | 
Example responses
- 200
{
  "id": "integer",
  "username": "string",
  "real_name": "string",
  "avatar": "string",
  "ext_id": "integer",
  "followings_counter": "integer",
  "followers_counter": "integer",
  "posts_counter": "integer",
  "discussions_counter": "integer",
  "polls_counter": "integer",
  "connection_status": "string",
  "categories_counter": "integer",
  "date_joined": "string",
  "bio": "string",
  "location": "string",
  "location_lat_lng": "string",
  "position_lat_lng": "string",
  "date_of_birth": "string",
  "description": "string",
  "gender": "string",
  "website": "string",
  "cover": "string",
  "tags": [{Tag}],
  "reputation": "integer",
  "community_badge": "boolean",
  "reg_approved": "boolean",
  "deleted" : "boolean",
  "company_name": "string",
  "company_role": "string"
}