1 /**
2 * @oas [post] /admin/users/{id}
3 * operationId: PostUsersId
4 * summary: Update a User
5 * description: Update a user's details.
6 * x-authenticated: true
7 * parameters:
8 * - name: id
9 * in: path
10 * description: The user's ID.
11 * required: true
12 * schema:
13 * type: string
14 * - name: fields
15 * in: query
16 * description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
17 * fields. without prefix it will replace the entire default fields.
18 * required: false
19 * schema:
20 * type: string
21 * title: fields
22 * description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
23 * fields. without prefix it will replace the entire default fields.
24 * externalDocs:
25 * url: "#select-fields-and-relations"
26 * requestBody:
27 * content:
28 * application/json:
29 * schema:
30 * $ref: "#/components/schemas/AdminUpdateUser"
31 * x-codeSamples:
32 * - lang: JavaScript
33 * label: JS SDK
34 * source: |-
35 * import Medusa from "@medusajs/js-sdk"
36 *
37 * export const sdk = new Medusa({
38 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
39 * debug: import.meta.env.DEV,
40 * auth: {
41 * type: "session",
42 * },
43 * })
44 *
45 * sdk.admin.user.update("user_123", {
46 * first_name: "John",
47 * last_name: "Doe",
48 * })
49 * .then(({ user }) => {
50 * console.log(user)
51 * })
52 * - lang: Shell
53 * label: cURL
54 * source: |-
55 * curl -X POST '{backend_url}/admin/users/{id}' \
56 * -H 'Content-Type: application/json' \
57 * --data-raw '{
58 * "first_name": "{value}",
59 * "last_name": "{value}",
60 * "avatar_url": "{value}"
61 * }'
62 * tags:
63 * - Users
64 * responses:
65 * "200":
66 * description: OK
67 * content:
68 * application/json:
69 * schema:
70 * $ref: "#/components/schemas/AdminUserResponse"
71 * "400":
72 * $ref: "#/components/responses/400_error"
73 * "401":
74 * $ref: "#/components/responses/unauthorized"
75 * "404":
76 * $ref: "#/components/responses/not_found_error"
77 * "409":
78 * $ref: "#/components/responses/invalid_state_error"
79 * "422":
80 * $ref: "#/components/responses/invalid_request_error"
81 * "500":
82 * $ref: "#/components/responses/500_error"
83 * x-workflow: updateUsersWorkflow
84 * security:
85 * - cookie_auth: []
86 * - jwt_token: []
87 * x-events:
88 * - name: user.updated
89 * payload: |-
90 * ```ts
91 * {
92 * id, // The ID of the user
93 * }
94 * ```
95 * description: Emitted when users are updated.
96 * deprecated: false
97 *
98 */
99