The Create a Gift Card service injects a new card into the system.
{base_url}/gift_cards
POST
None
None
Name | Type | Mandatory? | Constraints | Notes |
---|---|---|---|---|
card_id | string | no | - | Unique identifier provided by the issuer of the card. |
user_id | string | no | - | The user associated with the payment card. |
issuer | string | no | - | The merchant that issued the payment card. |
balance | float | no | - | How much money is left on the card. |
expiry_date | date | no | - | Date the gift card expires. |
A successful request returns the data you submitted plus a unique ID:
Name | Type | Mandatory? | Constraints | Notes |
---|---|---|---|---|
id | int | yes | Must be unique. | Internal unique ID assigned by the system. |
card_id | string | no | - | - |
user_id | string | no | - | - |
issuer | string | no | - | - |
balance | float | no | - | - |
expiry_date | date | no | - | - |
Code | Description | Notes |
---|---|---|
201 | Created | - |
Request:
curl -XPOST -H "Content-type: application/json" -d ' {
"card_id": "hanes-gc-003",
"user_id": "user004",
"issuer": "Hanes",
"balance": 200,
"expiry_date": "2026-12-31"
}' 'http://localhost:3000/gift_cards'
Response:
{
"card_id": "hanes-gc-003",
"user_id": "user004",
"issuer": "Hanes",
"balance": 200,
"expiry_date": "2026-12-31",
"id": 6
}