Support Forum [ All Topics | New Topic ]

Thread: How to insert all Instant Inventory in my website database using API ?

Hi,
I am using bellow code for display all the diamonds on my website page for the store in my local database , but getting only 50 records because there is a limitation, so anybody has a solution for this problem please help me.

I need to insert all diamonds inventory in my website database using PHP.

<?php
$data = '{"request": {"header": {"username": "xxxx","password": "xxx"},
"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);
?>


>> add a comment
DRC
08/12/2016 10:05


1 Replies:

hi,
you are not allowed to download the whole inventory. you can also get data for one page, and page size is maximum 50. 

>> add a comment
Ephraim
8/14/2016 4:35:00 AM