DEV Community

GreggHume
GreggHume

Posted on

Strapi: Update user via api

To update a user via the api you can do the following:

// route as PUT localhost:1337/api/users/1 // body { "firstname": "Mat", "lastname": "OD" } // response { "id": 1, "username": "matod", "email": "test@test.com", "provider": "local", "confirmed": true, "blocked": false, "createdAt": "2023-09-18T13:25:52.248Z", "updatedAt": "2023-09-19T18:07:03.885Z", "firstname": "Mat", "lastname": "OD", "role": { "id": 4, "name": "Organiser", "description": "Organisers permissions", "type": "organiser", "createdAt": "2023-09-19T17:12:57.632Z", "updatedAt": "2023-09-19T17:12:57.632Z" } } 
Enter fullscreen mode Exit fullscreen mode

A note, as of writing this "populate: *" param does not work if you want to get back component or related data.

Top comments (0)