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

Product Deals Sorting
Last updated: December 07 2018 05:56 PM

Sort Parameters Available For Product Deals

Parameter Type Value Description and examples
sort
optional
string data-allowance-asc or
data-allowance-desc
Returns deals sorted by data allowance

/?sort=deals(data-allowance-asc)
/?sort=deals(data-allowance-desc)
sort
optional
string total-cost-asc or
total-cost-desc
Returns deals sorted by total cost of contract

/?sort=deals(total-cost-asc)
/?sort=deals(total-cost-desc)
sort
optional
string upfront-cost-asc or
upfront-cost-desc
Returns deals sorted by upfront cost

/?sort=deals(upfront-cost-asc)
/?sort=deals(upfront-cost-desc)
sort
optional
string contract-price-asc or
contract-price-desc
Sort the deals by monthly contract price

/?sort=deals(contract-price-asc)
/?sort=deals(contract-price-desc)

Product Deals Sorting Example

GET
https://api.uconvert.co.uk/deals/v1/products/2203/?expand=products(deals)&filter[condition]=eq{new}&sort=deals(data-allowance-asc)
{
  "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"
    }
  ]
  "deals": [
    {
      "contractName": "Vodafone Essentials Plan",
      "contractLength": "24",
      "contractSupplierId": "4",
      "contractSupplierName": "Vodafone",
      "smallNetworkImage": "https://static.uconvert.co.uk/img/badges/network-small-4.png",
      "mediumNetworkImage": "https://static.uconvert.co.uk/img/badges/network-medium-4.png",
      "largeNetworkImage": "https://static.uconvert.co.uk/img/badges/network-4.png",
      "largeRetailerImage": "https://static.uconvert.co.uk/img/badges/retailer-5.png",
      "friendlyContractLength": "24 Month Contract",
      "dataAllowance": "250",
      "friendlyDataAllowance": "250Mb",
      "callAllowance": "250",
      "friendlyCallAllowance": "250",
      "textAllowance": "999999",
      "friendlyTextAllowance": "Unlimited",
      "dealLink": "https://deals.uconvert.co.uk/deal_redirect/5/258071140/",
      "dealType": "Consumer",
      "condition": "New",
      "totalDealCost": "1266.99",
      "supplierId": "5",
      "supplierName": "Mobile Phones Direct",
      "productUpfrontCost": "834.99",
      "supplierContractPrice": "18.00",
      "giftImg": "https://static.uconvert.co.uk/img/gifts/free-hive-active-heating-with-installation.png",
      "productImg": "https://static.uconvert.co.uk/img/products/samsung/samsung-galaxy-s9-plus/coral-blue/front.png",
      "giftName": "Free Hive Active Heating With Installation",
      "productName": "Samsung Galaxy S9 Plus 128GB Coral Blue"
    },
    {},
    {},
  ]
} 
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.uconvert.co.uk/deals/v1/products/2203/?expand=products(deals)&filter[condition]=eq{new}&sort=deals(data-allowance-asc)",
  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/?expand=products(deals)&filter[condition]=eq{new}&sort=deals(data-allowance-asc)' \
--header 'x-api-key: 123456'
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.uconvert.co.uk/deals/v1/products/2203/?expand=products(deals)&filter[condition]=eq{new}&sort=deals(data-allowance-asc)",
  "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/?expand=products(deals)&filter[condition]=eq{new}&sort=deals(data-allowance-asc)")

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