Skip to main content
07399 456 959 [email protected]

Gifts Fields
Last updated: January 05 2022 11:19 PM

Fields Parameter Values Available For Gifts

To significantly reduce the amount of data returned and improve the performance of your API request and performance of your application use a partial request receiving only the data that your application is interested in. This allows your application to perform more efficiently. By default, the server sends back the full representation of a resource you requested. For improved performance, you can request only the fields you need. To request a partial response, use the fields query parameter and specify the fields you want returned.

You can use the fields parameter with almost all endpoints. Use a comma-separated list within the brackets to select multiple fields. E.g. /?fields=gifts(heading,introduction)

Parameter Type Values Description and examples
fields
optional
string heading,
introduction
Gifts Content - returns single or multiple values

/?fields=gifts{heading,introduction}
fields
optional
string meta-data-title,
meta-data-description,
meta-data-keywords
Gifts Meta Data - returns single or multiple values

/?fields=gifts{meta-data-title,meta-data-description}
fields
optional
string front,
large,
jpg,
png,
webp
Gifts Images - returns a single src to a gift image

/?fields=gifts{front,large,png}

Gifts Fields Request Example

GET
https://api.uconvert.co.uk/deals/v1/gifts/?fields=gifts(heading,meta-data-title)
{
  "gifts" : [
    {
      "id": "49",
      "name": "Google Chromecast",
      "slug": "google-chromecast",
      "content": {
        "heading": "Free Google Chromecast"
      },
      "metaData": {
        "title": "Free Google Chromecast"
      }
    },
    {
      "id": "92",
      "name": "£50 Love2Shop Voucher",
      "slug": "50-love2shop-voucher",
      "content": {
        "heading": "Free £50 Love2Shop Voucher"
      },
      "metaData": {
        "title": "Free £50 Love2Shop Voucher"
      }
    }
    {},
    {},
    {}
  ]
}
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.uconvert.co.uk/deals/v1/gifts/?fields=gifts(heading,meta-data-title)",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-api-key: 123456"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
curl --request GET \
  --url 'https://api.uconvert.co.uk/deals/v1/gifts/?fields=gifts(heading,meta-data-title)' \
  --header 'x-api-key: 123456'
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.uconvert.co.uk/deals/v1/gifts/?fields=gifts(heading,meta-data-title)",
  "method": "GET",
  "headers": {
    "x-api-key": "123456"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
require 'uri'
require 'net/http'

url = URI("https://api.uconvert.co.uk/deals/v1/gifts/?fields=gifts(heading,meta-data-title)")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '123456'

response = http.request(request)
puts response.read_body