API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

What data is returned to me


So i'm working with the SOAP api where i'm playing around with what type of data I can access and use. For now i'm only using a demo account. What i'm trying to wrap my head around at the moment is the Order_GetAll() which I would expect to return a list of the orders. My code is:

$client = new SoapClient('http://www.e-conomic.com/secure/api1/EconomicWebService.asmx?wsdl');

$response = $client->ConnectWithToken(array(
    'token' => 'token',
    'appToken' => 'appToken'

$getOrders = $client->Order_GetAll();


When I log in myself I can easily see there are two orders in the 
system. But somehow the object return contains three items with an 
Id value I don't seem to recognise from anywhere.

stdClass Object ( [Order_GetAllResult] => stdClass Object ( [OrderHandle]
 => Array ( [0] => stdClass Object ( [Id] => 30 ) [1] => stdClass Object 
( [Id] => 31 ) [2] => stdClass Object ( [Id] => 32 ) ) ) ) 

So anyone able to tell me what I'm actually getting out here? What I'm 
working towards is getting orders with some values that can be displayed 
such as a name/title, an amount etc. 
created May 18, 2016 by gerre
100% Accept Rate
Q 2 A 0 C 1

1 Answer

Best answer

Take a closer look at this : https://github.com/e-conomic/eco-api-ex/tree/master/examples/php

You get the orderhandles in return.

Your code should look like this :

$getOrders = $client->Order_GetAll()->Order_GetAllResult->OrderHandle;
$Orderdataobjects=$client->Order_GetDataArray(array('entityHandles' => $getOrders))->Order_GetDataArrayResult->OrderData;

foreach ($Orderdataobjects as $i => $OrderData) {

echo $OrderData->DebtorName.'<br>';


Should work, else make a var_dump()

answered May 19, 2016 by larsbrandi
selected May 20, 2016 by olej
Thanks for the reply. Yes after waking up and reading the docs a bit closer I realized they were Id's/handles to the orders. So with Order_GetData() I was able to pull out all the data. So something similar as yours.
Visma e-conomic A/S