Skip to main content
07399 456 959 admin@uconvert.co.uk

Product Images Object - Partial Request
Last updated: December 07 2018 05:56 PM

Fields Parameter Values Available For Products Images Object

A way to improve the performance of your API request is by requesting a partial response 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.

If you want to return the url for a single or multiple images use the fields query parameter. The parameter must contain at least one view (front,back,left,right), one size (large,medium,small) and one format (webp,png,jpg). Use a comma-separated list to select images.

E.g. /?fields=products(front,back,left,right,large,png) or /?fields=products(front,medium,jpg)

The fields query parameter is used to retrieve single or multiple images in the response for the product images object. A list of fields values for product images object are shown below.

Parameter Type Values Description and examples
fields
optional
string large, medium, small
front, back, left, right
png, jpg, webp
Returns single or multiple images

/?fields=products(large,front,png)
/?fields=products(medium,,back,front,jpg)a

Product Images Object Partial Request Example

GET
https://api.uconvert.co.uk/deals/v1/products/?fields=products(front,back,large,jpg)
{
  "products" : [
    {
      "id": "1044",
      "name": "Apple iPhone 6 16GB Space Grey",
      "slug": "apple-iphone-6-16gb-space-grey",
      "cheapestUpfrontCost": "0.00",
      "cheapestContractPrice": "30.00",
      "condition": "New",
      "colour": "Space Grey",
      "hexColour": "#656668",
      "capacity": "16GB",
      "images": {
        "largeFrontImageJpg": "https://static.uconvert.co.uk/img/products/apple/apple-iphone-5s/space-grey/front_l.jpg",
        "largeBackImageJpg": "https://static.uconvert.co.uk/img/products/apple/apple-iphone-5s/space-grey/back_l.jpg"
      }
    }
  ]
}
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.uconvert.co.uk/deals/v1/products/?fields=products(front,back,large,jpg)",
  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/products/?fields=products(front,back,large,jpg)' \
  --header 'x-api-key: 123456'
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.uconvert.co.uk/deals/v1/products/?fields=products(front,back,large,jpg)",
  "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/products/?fields=products(front,back,large,jpg)")

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