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

Get A Single Product
Last updated: December 07 2018 05:56 PM

Headers

Attribute Type Description
x-api-key
required
string The api token you will use to authorise requests to the API.

Path Parameter

Attribute Type Description
id integer An id of a product

Query Parameters Available for A Single Product

Parameter Type Description
filter
optional
string Filter the product results
expand
optional
string Get associated content for all products
fields
optional
string Reduce the number of properties returned for products
limit
optional
string The number of products to return per page
sort
optional
string Sort the products

Get A Single Product Request Example

When requesting a single product always use /?filter[condition]=eq{new} or /?filter[condition]=eq{refurbished} otherwise you may end up with 2 products (as shown below)

GET
https://api.uconvert.co.uk/deals/v1/products/2203/
{
  "products": [
    {
      "id": "2203",
      "name": "Samsung Galaxy S9 Plus 128GB Coral Blue",
      "slug": "samsung-galaxy-s9-plus-128gb-coral-blue",
      "cheapestUpfrontCost": "0.00",
      "cheapestContractPrice": "43.00",
      "condition": "New",
      "colour": "Coral Blue",
      "hexColour": "#377ea3",
      "capacity": "128GB"
    },
    {
      "id": "2203",
      "name": "Samsung Galaxy S9 Plus 128GB Coral Blue",
      "slug": "samsung-galaxy-s9-plus-128gb-coral-blue",
      "cheapestUpfrontCost": "30.00",
      "cheapestContractPrice": "33.73",
      "condition": "Refurbished",
      "colour": "Coral Blue",
      "hexColour": "#377ea3",
      "capacity": "128GB"
    }
  ]
} 
$curl = curl_init();

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

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