Logo

dev-resources.site

for different kinds of informations.

Strapi: Update user via api

Published at
9/19/2023
Categories
strapi
api
user
update
Author
GreggHume
Categories
4 categories in total
strapi
open
api
open
user
open
update
open
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": "[email protected]",
  "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"
  }
}

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

Featured ones: