REST API GET mos

Hello there,
I am currently testing the API of Dolibarr. It has some calls that might be helpful, but could have more. What I came here for is to ask about the “GET mos” call.
When I try this call on the explorer of my site it gives me the following:
grafik
This is a test server on V15.0.2, were there are over 100 MOs in the system.
What is the problem here?
Hope you can help explain.

Kind regards,
RPBTworker

Hello,

API reply that it doesn’t found MOs
So either you don’t have, or the filter you have put in the request doesn’t match any MOs

Hello @ksar,
I tested it on the explorer site. Here are the filters:


I believe those parameters should give me the 10 first mos according to the rowid.
I have, as mentioned before, over 100 MOs in the DB, so I am dumbfounded how that call can’t find anything.
But maybe I am misunderstanding something. If so, please teach me :slight_smile:

Kind regards,
RPBTworker

Hello,

I’m not an API expert, unfortunately.
What is the answer if you put nothing in parameters ?

Hi there,
Sadly the answer stays the same. Evene without the standard parameters in the explorer (sortfield, sortorder, limit). :frowning:

If you have access to the source-code you can temporarily change the results.

Comment return $obj_ret;
and add return $sql;
grafik

So you can see the resulting sql-command for your api-call in the response body:
grafik

This can then used in phpmyadmin or similar…

Ooh I see that you have to comment also the lines 182-184
grafik

Hello,
was off for a while.
I tried it and with out commenting lines 182-185 and it gave me a 200 reponse. When I commented it back in it gave me again the 404 response. When commenting out line 182-184 it give me the following:


My assumption is that there is a problem with how the API accesses the MariaDB database, but only for MOs which is weird.
Will look further into it, try to post updates if I find something.
Thank you for the response, it gave me a new viewpoint to look at.
If you have something else, I am looking forword to hearing about it.

Please look at my former post…
Did you insert the line 186? (return $sql)
Without this nothing is returned.

I did insert line 186 (return $sql) and commented lines 182-185 out. That was the first try. That gave me a 200 response code, but no repsonse body.
Then I tried line 185 and 186 (return $obj_ret return $sql), lines 182-184 where commented out. The outcome is seen in my picture.
It did give me a 200 response code, but an empty response body. This means somehow the API can not get my MOs. :frowning:

Hello all,

it is not possible to select the entity from the “Dolibarr REST API Explorer”
On the other hand in the API request via php curl it is necessary to send the id of the entity in the header in the same way as the API key:

$httpheader[] = 'DOLAPIKEY: xxxxxxxxxxxxx';
$httpheader[] = 'DOLAPIENTITY: 2';

curl_setopt($c, CURLOPT_HTTPHEADER, $httpheader);