WordPress REST Api: update user
I have created an user via wordpress api, then after registration, I save user's username and password into the sessionStorage, and then, finaly, try to edit user's profile. Here's my post request data
POST /wp-json/wp/v2/users?context=edit HTTP/1.1
Host: something.com
Connection: keep-alive
Content-Length: 292
Accept: application/json, text/plain, */*
Origin: http://localhost:8100
Authorization: Bearer ********************************************************************************************************
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36
Content-Type: application/json;charset=UTF-8
Referer: http://localhost:8100/
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
POST Body
"postData": {
"mimeType": "application/json;charset=UTF-8",
"text": "{\"first_name\":\"Foo\",\"last_name\":\"Bar\",\"city\":\"Belgrade\",\"zip\":11000,\"address\":\"Foobar 7\",\"email\":\"[email protected]\",\"username\":\"foobar\",\"name\":\"Foo Bar\",\"nickname\":\"Foo Bar\",\"password\":\"myexamplepass\",\"context\":\"edit\",\"meta\":{\"city\":\"Belgrade\",\"zip\":11000,\"address\":\"FooBar 17\"}}"
}
Now, with that request, I get {"code":"rest_cannot_create_user","message":"Sorry, you are not allowed to create new users.","data":{"status":403}}
Response is:
{
"code": "rest_cannot_create_user",
"message": "Sorry, you are not allowed to create new users.",
"data": {
"status": 403
}
}
Now, if I try to create a post with that very user, via postman, it works properly. What am I doing wrong here?