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

Get Debtors - php



I'm trying to get debtors right now, and I'm running into an error.

The client connects perfectly, no error there, however when i want to get debtors I'm Getting "Cannot use object of type stdClass as array".

$debtorGroupHandles = $client->DebtorGroup_GetAll()->DebtorGroup_GetAllResult->DebtorGroupHandle;

$firstDebtorGroup = $debtorGroupHandles[0];

Doing a var_dump() on the $debtorGroupHandles, gives me this info: "object(stdClass)#4 (1) { ["Number"]=> int(1) } "

Am I doing something wrong?



created Sep 19, 2013 by Jazerix
0% Accept Rate
Q 1 A 0 C 0

1 Answer

The response is not an array but a PHP object. Thus, you cannot access the variable with "$debtorGroupHandles[0]" but should instead use the object accessor "$debtorGroupHAndles->Number".

How many debtor groups do you have? I think this is one of the tricky functions that will only return an array if more than one is found.
answered Sep 20, 2013 by Alex Langberg
Visma e-conomic A/S