Method getLinks
Description
This method allows you to obtain the gift page and exchange URLs for a certificate using either the request identifier (queue_id) or the order identifier on the Giftery platform (order_id).
If getLinks is called in test mode (testmode=1), the method will return a link to a demo Giftery certificate when accessed via queue_id.
Request Parameters (data)
You must provide at least one of the two parameters in the request. If both are provided, the queue_id parameter takes precedence.
| Parameter | Description |
|---|---|
queue_id | Request identifier. Integer greater than zero. Returned by the makeOrder method. |
order_id | Order identifier on the Giftery platform. Integer greater than zero. |
Response Parameters (data)
| Parameter | Description |
|---|---|
exchange_url | URL to redeem the certificate. If not available, null is returned. |
gift_page_url | URL of the gift page for receiving the certificate. If not available, null is returned. |
Example
bash
# Generate the value for SIG
# SECRET is the client-side secret key used to sign API requests
$ echo -n 'getLinks{"queue_id":123456}SECRET' | sha256sum - | awk '{print $1}'
# Use the known client ID and generated SIG to make the request
$ curl 'https://api.giftery.es/?cmd=getLinks&id=ID&in=json&out=json&data=%7B%22queue_id%22%3A123456%7D&sig=SIG'Example of a Successful Response
json
{
"status": "ok",
"data": {
"exchange_url": "https://activate.giftery.es/exchange?code=99999-999-999-999&pin=9999",
"gift_page_url": "https://my.giftery.app/gift/new/19999991234567890"
}
}Error Response Example
json
{
"status": "error",
"error": {
"code": 1202,
"text": "Order not paid"
}
}| Error Code | Description |
|---|---|
| 3608 | Neither queue_id nor order_id was provided (required parameters). |
| 3609 | Unknown request identifier (queue_id = {queue_id}). |
| 3610 | Unknown order identifier (order_id = {order_id}). |
| 1202 | Order not paid. This status may appear within 1–2 seconds after processing has started. If received, retry the request after a short delay. |
| 1205 | An error occurred during order processing. Please contact support at dev@giftery.es. |
| 1208 | The order has been accepted and assigned the status of a deferred order. See the deferred order documentation. |
| 1209 | The order is still in the processing queue. If getLinks was called immediately after makeOrder, the order might not have begun processing yet. Retry the request in one minute. If this status persists for several minutes or more, it means there is a high volume of incoming orders. Please wait and try again. |