The Create a User service injects a new user into the system.
{base_url}/users
POST
None
None
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 a 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 |
---|---|---|
201 | Created | - |
Request:
curl -XPOST -H "Content-type: application/json" -d ' {
"user_id": "user005",
"amazon_id": "amz09876",
"name": "Steve Stevens",
"email": "steve.stevens@example.com",
"gift_cards": [
"gap-gc-005",
"hanes-gc-002"
]
}' 'http://localhost:3000/users'
Response:
{
"user_id": "user005",
"amazon_id": "amz09876",
"name": "Steve Stevens",
"email": "steve.stevens@example.com",
"gift_cards": [
"gap-gc-005",
"hanes-gc-002"
],
"id": 6
}