The Update a User service changes the details for a given user.
{base_url}/users/{id}
PUT
None
Path parameters:
Name | Type | Mandatory? | Constraints | Notes |
---|---|---|---|---|
id | int | yes | Internal unique ID assigned by the system. |
Name | Type | Mandatory? | Constraints | Notes |
---|---|---|---|---|
user_id | string | yes | Must be unique. | Unique ID. |
amazon_id | string | yes | - | The user’s Amazon account ID. |
name | string | yes | - | The user’s full name. |
string | yes | Must contain an ‘@’ symbol. | The user’s email address. | |
gift_cards | string[] | no | - | Array of gift cards associated with the user. |
A successful request returns the data you submitted plus the user’s unique id
:
Name | Type | Mandatory? | Constraints | Notes |
---|---|---|---|---|
id | int | yes | - | Unique internal ID generated by the system. |
user_id | string | yes | - | - |
amazon_id | string | yes | - | - |
name | string | yes | - | - |
string | yes | - | - | |
gift_cards | string[] | yes | - | - |
Code | Description | Notes |
---|---|---|
200 | OK | - |
The following example updates the name
and email
for user id
6:
Request:
curl -XPUT -H "Content-type: application/json" -d ' {
"user_id": "user005",
"amazon_id": "amz09876",
"name": "Stefan Stevens",
"email": "stefan.stevens@example.com",
"gift_cards": [
"gap-gc-005",
"hanes-gc-002"
]
}' 'http://localhost:3000/users/6'
Response:
{
"user_id": "user005",
"amazon_id": "amz09876",
"name": "Stefan Stevens",
"email": "stefan.stevens@example.com",
"gift_cards": [
"gap-gc-005",
"hanes-gc-002"
],
"id": 6
}