I don’t know why, but this Curl API is unable to retrieve the data from “Accepted Orders” even though the response status code is 200 and the response body is 0.
Code:
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pos.globalfoodsoft.com/pos/order/pop",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Authorization: xxxxxxxxxxxxxxx",
"Glf-Api-Version: 2"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
Body
{
“count”: 0,
“orders”: []
}
However, the same Curl API is able to retrieve the data in the “Fetch Menu”.
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pos.globalfoodsoft.com/pos/menu",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Authorization: XXXXXXX",
"Glf-Api-Version: 2"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
REF – API Docs: https://github.com/GlobalFood/integration_docs