Home

Saturday, August 20, 2016

How to get Diamond Inventory from RapNet using API ?

<?php
$data = '{"request": {"header": {"username": "xxxxxxx","password": "xxxx"},
"body": {
"shapes": [],
"size_to": "",
"size_from": "",
"color_from": "",
"color_to": "",
"clarity_from": "",
"clarity_to": "",
"cut_from": "",
"cut_to": "",
"polish_from": "",
"polish_to": "",
"symmetry_from": "",
"symmetry_to": "",
"labs": [],
"price_total_from": "",
"price_total_to": "",
"page_number": "1",
"page_size": "20",
"sort_by": "price",
"sort_direction": "ASC"
}}}';
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);

curl_setopt($curl, CURLOPT_URL, 'http://technet.rapaport.com/HTTP/JSON/RetailFeed/GetDiamonds.aspx');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
$data = json_decode($result,true);
$diamonds_returned = $data['response']['body']['search_results']['diamonds_returned'];
$total_diamonds_found =  $data['response']['body']['search_results']['total_diamonds_found'];
echo "<pre>";
print_r($data);
curl_close($curl);
?>

No comments:

Post a Comment

rathoddhirendra.blogspot.com-Google pagerank and Worth