The Get a Gift Card service returns the details for a given card.
{base_url}/gift_cards/{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 | - | - |
card_id | string | no | - | - |
user_id | string | no | - | - |
issuer | string | no | - | - |
balance | float | no | - | - |
expiry_date | date | no | - | - |
Code | Description | Notes |
---|---|---|
200 | OK | - |
Request:
curl http://localhost:3000/gift_cards/1
Response:
{
"id": 1,
"card_id": "hanes-gc-001",
"user_id": "user001",
"issuer": "Hanes",
"balance": 50,
"expiry_date": "2025-12-31"
}
Note: The service always responds with HTTP status 200 even for cards 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 Gift Card 999:
curl -GET "http://localhost:3000/gift_cards/999"
returns:
{}