PHP - GetOpenOrders

I seem to be having a problem with the API using GetOpenOrders. The following message is returned:

Object reference not set to an instance of an object.

I'm not sure what is going wrong, and I can't even seem to find anything useful around. I can get GetAllOpenOrders and GetStockItemsFull working but not GetOpenOrders. Below is the code I am currently using.


// $token is from AuthorizeByApplication

$filters = array('ListFields' =>  array(array('FieldCode' => 'STOCK_LEVEL','Value' => -1,'Type' => 1)));
$sorting = array();

$url = ''.$token.'&entriesPerPage=100&pageNumber=1&&filters='.json_encode($filters).'sorting='.json_encode($sorting).'&fulfilmentCenter=00000000-0000-0000-0000-000000000000&additionalFilter=';

$ch = curl_init();
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10 );
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/x-www-form-urlencoded; charset=UTF-8'));
 curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($ch, CURLOPT_TIMEOUT, 10);

$output = curl_exec($ch);
$info = curl_getinfo($ch);
$decoded = json_decode($output);



Hello Wayne!

Please confirm that using correct server from AuthorizeByApplication call resolved this issue.

Kind regards,


Login to post a comment