Jump to content

Failure When Retrieving The Orders Of Filtered Customers Via The Api


LucSorel

Recommended Posts

Hi there,

 

We are working on a connector which synchronizes the data of PrestaShop customers with other SaaS applications. In the process, I succeeded in retrieving customers data via an API call in the form of myprestashop/api/customers/?display=full&{some filtering conditions}.

 

Concatenating the customer's ids allows me to create the following API call to bulk-retrieve the orders filtered by the ids of the customers I am processing: myprestashop/api/orders?display=full&filter[id_customer]=[3,4,5] (where "3,4,5" is the concatenation mentionned beforehand). This call:

  1. works if all customers have at least one order
  2. contains only the orders of customer 3 if customer 4 has no order, but customer 5 has some
  3. contains no order at all if customer 3 has no order, but bothcustomers 4 and 5 have some

Obviously in the 2. and 3. cases, I would have expected the API to return the orders of all the filtered customers. I haven't found a similar issue in the PrestaShop forums (couldn't even find a forum dedicated to the API). Am I using the API the wrong way?

 

I am using PrestaShop 1.4.7.3 since one of our customers is using this version, thus our connector must work with 1.4.X API. I am puzzled because:

  • case 1. works as expected
  • I am logging PHP errors and nothing was logged. Moreover, had an error occured, I would expect an <error> tag in the API response

Until some of you can send some feedback, I guess my only solution is to perform one "orders" call per customer (eg. myprestashop/api/orders?display=full&filter[id_customer]=3) but this breaks the interest of using a bulk API by producing a lot of bandwith traffic and slowing down the whole process.

 

Thanks for reading this post so far! :)

Edited by LucSorel (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...