0

How do I update user field via JSON API with D8?

EndPoint:https://domainname.com/jsonapi/user/user/

Method:PATCH

Request Header;

Accept:application/vnd.api+json
Content-Type:application/vnd.api+json
X-CSRF-Token:xxxxxxxxxx

Body:

"data": {
        "type": "user--user",
        "id": "xxxxxx-7798-45e5-a16c-xxxxxxxxxxxx",
        "attributes": {
            "field_test1": [
                "data1",
                "dara2"
            ]
        }
    }

But below error

        "title": "Method Not Allowed",
        "status": "405",
        "detail": "No route found for \"PATCH /jsonapi/user/user/\": Method 
        Not Allowed (Allow: POST, GET, HEAD)",
0

You need to also put UUID in your request URL, so it should look like

EndPoint:https://domainname.com/jsonapi/user/user/xxxxxx-7798-45e5-a16c-xxxxxxxxxxxx
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.