With our lt_sbox token, we'll be creating gifts in our sandbox with the API, and confirming its creation with the gifting web site.
This will involve a POST
to the /teams/sandbox/gifts
endpoint. The example below will send the gift email November 12th 2016 at 3PM UTC time. Feel free to adjust.
curl -i https://api.loopandtie.com/v1/teams/sandbox/gifts \
-H "Authorization: Bearer [[app:key]]" \
-H "Content-Type: application/json" \
-X POST \
-d '{"gift":
{
"name": "Ziggi",
"email": "[email protected]",
"collection": "$25",
"message": "Better than Bob",
"from": "Peter Tosh",
"scheduled_at": "2016-11-12T15:00:00Z"
}
}'
On success, the gift's JSON will be returned.
{
"data": {
"id": "GB1600D90811L",
"type": "gifts",
"attributes": {
"external-id": "GB1600D90811L",
"team": "sandbox",
"sender-name": "Dimitri Roche",
"untie-url":"http://www.loopandtie.com/untie/jFAxxxxxxxxxxx",
"email": "[email protected]",
"stage": "scheduled",
"last-event-at": "2015-11-12T15:04:00.013Z",
"scheduled-at": "2016-11-12T15:06:49.000Z",
"subject":"Peter Sent You A Gift!",
"message": "Better than Bob",
"from": "Peter Tosh",
"events": [{ "stage": "scheduled", "message": null, "created-at": "2015-11-12T15:04:00.018Z" }]
},
"relationships": {
"sender": { "data": { "id": "1", "type": "users" } },
"collection": { "data": { "id": "4", "type": "collections" } },
"logo": { "data": { "id": "126", "type": "logos" } },
"design": { "data": { "id": "standard-gift-of-choice-v2", "type": "designs" } }
}
},
"included": [
{
"id": "1",
"type": "users",
"attributes": { "name": "Dimitri Roche", "email": "[email protected]" }
},
{
"id": "4",
"type": "collections",
"attributes": { "name": "$25", "global": true, "price": "25.00" }
},
{
"id": "126",
"type": "logos",
"attributes": { "name": "Loop & Tie", "global": true, "image-url": "https://d2ncrfzc0pt6uh.cloudfront.net/uploads/logos/2387/1531343620/standard.png?1531343620" }
},
{
"id": "standard-gift-of-choice-v2",
"type": "designs",
"attributes": {
"name": "Standard Gift Of Choice v2",
"global": true,
"has-logo": true,
"image-url": "https://d2ncrfzc0pt6uh.cloudfront.net/uploads/designs/8/1441980212/uploads/standard.jpg?1441980212",
"thumbnail-url": "https://d2ncrfzc0pt6uh.cloudfront.net/uploads/designs/8/1441980212/uploads/thumbnail.jpg?1441980212"
}
}
]
}
Now that the gift has been created, navigate to your sandbox to see the newly created gift!