Jump to content

Join several WebService Calls


wiggly
 Share

Recommended Posts

Hello, I want to join multiples webservice calls.

 

For example, when I call to: /api/products/1, webservice returns several data, one of this ... id_default_combination. I would like to get that combination information when I call to /api/products/1. I mean only one call to the webservice, not 2.

 

Is it possible?

 

Thank you very much!!

 

Best regards!

Share this post


Link to post
Share on other sites

  • 10 years later...
Posted (edited)

Because people still get to this post even though it is old (it is one of the first in google), here is the solution:

To receive the data for several entries of one resource, you are calling the URL without an ID, as example:

/api/products/

On this you can add several additional parameters to limit what you receive, with the 'filter' keyword. If you need a list of specific IDs, you can request:

/api/products/?filter[id]=[1|2|3|5|10]

And last you add what data you want to receive, with the 'display' keyword. You can use either 'full' or a list of fields to return, like this:

/api/products/?filter[id]=[1|2|5|10]&display=full
/api/products/?filter[id]=[1|2|3|5|10]&display=[id,name]

For a full list of capabilities using 'filter' and all available keywords, see: https://devdocs.prestashop.com/1.7/webservice/tutorials/advanced-use/additional-list-parameters/

Edited by innovacy (see edit history)
  • Like 2

Share this post


Link to post
Share on other sites

  • 5 months later...

HI @innovacy,

And is it possible to get more information in one API GET request?
For example, I would like to get all invoice data in one api instaid of using multiple

/api/order_invoices/5 
/api/order_details/5
/api/order_details/5

 

Share this post


Link to post
Share on other sites

Well, if you look at the way you calling that, you got your answer. If it's the url determining the resource you requesting, then no, you can't pack several URLs in one HTTP request. You can ask for several entries of the same resource, with the help of filters, but you cannot do different resources in the same HTTP GET request.

Edited by innovacy (see edit history)

Share this post


Link to post
Share on other sites

Okay, clear thanks.  Relatively new to API, and I'm setting up a connection with Pabbly (zapier alternative). 
To have less requests, I'll have to use the MSQL connection then.

 

Thanks for your reply.

Lucas

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More