Patch a Specific User
This endpoint patches a specific user identified by {id}
info
A user can only update their personal data.
username
field must be unique and valid (valid characters are: a-z A-Z 0-9 _-).
info
You can use this endpoint to edit a single field passing only the id and the needed field (without mandatory fields).
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
PATCH /api/v2/user/{id}/
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | true | A unique integer value identifying this user |
body | body | User | false | The request body(user params) |
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",
"avatar": "string",
"cover": "string",
"gender": "string",
"website": "string"
};
const headers = {
'Content-Type': 'multipart/form-data',
'Accept': 'application/json',
'Authorization: Bearer <token>'
};
fetch('/api/v2/user/{id}/',
{
method: 'PATCH',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
# You can also use wget
curl -X PATCH /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"
}