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

How to use Product_FindByNumberList [PHP]

0

Hi guys

I'm trying to retrieve productdetails for a list/array of products.

I get a Fatal error: Uncaught SoapFault exception: [soap:Server] Economic.Api.Exceptions.ServerException(E00000): An internal error has occurred. (id=18b6ed52-0fd7-4f09-b8e6-c10b1ea42ab7) from the code below, could you guys help me out here ?

$res = $client->Product_FindByNumberList(array("number"=>"10012-10"))->Product_FindByNumberListResult;
echo var_dump( $res );

Thanks for your time :)

created Oct 28, 2013 by internetservice
67% Accept Rate
Q 7 A 2 C 5

1 Answer

0

I think you might have confused the response XML with the request XML. The error is in the array you are sending "array("number"=>"10012-10")" - if you look at the documentation, you can see that you rather have to send something along the lines of this: 

array("numbers"=>array("string", "10012-10"))

answered Oct 29, 2013 by Alex Langberg
Hi Alex,
Thanks for your reply - obviously your'e correct :)
Now I changed my query to this
$res = $client->Product_FindByNumberList(array("numbers"=>array("string"=>"Sp 15°","string"=>"Sp 25°")))->Product_FindByNumberListResult;

But when I log the result it seems like I only get the last result =
stdClass Object
(
    [ProductHandle] => stdClass Object
        (
            [Number] => Sp 25°
        )

)
I was hoping for an array that I could use to retrieve data for a suite of products - did I miss something (more) ?
Regards Mark
Take a look at the documentation again. It's not really that clear about it but if you look closely, you can see that they are actually sending this:

<numbers>
   <string>string</string>
   <string>string</string>
</numbers>

So you actually need to send a <string> for each product you want a return value for.
Hi Alex

I am doing exactly that, but when I debug-dump the result returned, I only get a result for the last of my supplied strings/varenr

Is this expected result ?
Hmm, yeah, it looks alright to me but I'm not sure what is wrong then. According to the docs, you should be getting an empty index in the array for the one that doesn't return a result. It looks to me like you're doing it so perhaps someone else has some input?
Visma e-conomic A/S
...