Skip to main content

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

NameInTypeRequiredDescription
idpathstringtrueA unique integer value identifying this user.
bodybodyUsertrueThe request body(user params to update)

Example Body Parameters

{
"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

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);
});

Responses

StatusMeaningDescriptionSchema
200OKResponse status codeUser

Example responses

{
"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"
}