Skip to main content
07399 456 959 [email protected]

Product Sorting
Last updated: January 05 2022 11:19 PM

Sort Parameter Values Available For Products

Parameter Type Values Description and examples
sort
optional
string name-asc or name-desc Sort the products by name

/?sort=products(name-asc)
/?sort=producs(name-desc)
sort
optional
string manufacturer-asc or manufacturer-desc Sort the products by manufacturer name

/?sort=products(manufacturer-asc)
/?sort=products(manufacturer-desc)
sort
optional
string release-date-asc or release-date-desc Sort the products by release date

/?sort=products(release-date-asc)
/?sort=products(release-date-desc)
sort
optional
string upfront-cost-asc or upfront-cost-desc Sort the products by upfront cost

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

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

Product Sort Example

Sorting products

GET
https://api.uconvert.co.uk/deals/v1/products/?sort=products(manufacturer-asc)
{
  "products": [
    {
      "id": "2070",
      "name": "Alcatel Shine Lite 16GB White",
      "slug": "alcatel-shine-lite-16gb-white",
    },
    {
      "id": "2071",
      "name": "Alcatel Idol 4 16GB Black",
      "slug": "alcatel-idol-4-16gb-black",
    }
  ]
} 
$curl = curl_init();

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