The Get a User service returns the details for a given user.
{base_url}/users/{id}
GET
None
Path parameters:
Name | Type | Mandatory? | Constraints | Notes |
---|---|---|---|---|
id | int | yes | Internal unique ID assigned by the system. |
None
Name | Type | Mandatory? | Constraints | Notes |
---|---|---|---|---|
id | int | yes | Must be unique. | Internal unique ID generated by the system. |
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[] | yes | - | Array of gift cards associated with the user. |
Code | Description | Notes |
---|---|---|
200 | OK | - |
Request:
http://localhost:3000/users/1
Response:
{
"id": 1,
"user_id": "user001",
"amazon_id": "amz12345",
"name": "John Doe",
"email": "john.doe@example.com",
"gift_cards": [
"hanes-gc-001",
"nike-gc-002"
]
}
Note: The service always responds with HTTP status 200 even for users that do not exist in the system. Instead of returning status 404 (Not Found), the service returns an empty data set.
For example, searching for non-existing user 999:
curl -GET "http://localhost:3000/gift_cards/999"
returns:
{}