I am building an API using JSON to offer to our customers so they can check inventory levels on our product(s). Everything works fine when testing 1 product. My question is, what is the best method to receive a $_GET request that could possibly be 1 product or up to 5k products? Would those multiple products get built into the request URL? Or, would the requesting party loop thru and call the API with 1 products at a time?
I've worked with UPS using XML & cURL where I set CURLOPT_POSTFIELDS that contains multiple params but I am not sure how to build the request using the method I've created.
Here is a basic example of what my request looks like:
//user request
$url = 'http://php.mybizurl.com/public/api/api_get_data.php';
$api = 'api_inventory_check';
$key = '12341234';
$fmt = 'json';
//api_get_data.php gets the URL params, query's the DB, json_encode & outputs
$result = file_get_contents($url . '?api=' . $api . '&num=' . $key . '&format=' . $fmt);
Hopefully that makes some sense. I appreciate any insight.
THanks,
J