I'm trying to do a simple API call in BigCommerce.
I got some info from these links:
Get a Count of Orders
BigCommerce API Quickstarts
I've tried orders.json and orders/count, but I do not get any response.
I must be missing something simple. Do I have to echo the response somehow?
Here is my code.
curl --request GET \
-u "username:key" \
I received a reply from BigCommerce and it was no help.
I ran this code, in a .php file, on a GoDaddy hosted server running PHP 5.6.22 and cURL 7.36.0.
<?php $username = "Username"; $password = "API Token"; $URL = "https://store.com/api/v2/orders/count.json"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $URL); curl_setopt($ch, CURLOPT_TIMEOUT, 30); //Timeout after 30 seconds curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); //Get status code $response = curl_exec($ch); curl_close($ch); $result = json_decode($response); echo "Count = " . $result->count; //Total orders echo "<br />" . $result->statuses->name . " = " . $result->statuses->count; //Shipped orders ?>