Wednesday 11 May 2016

APEX 5 and RESTful Service

How to pass multiple parameters

Quick overview on how to pass multiple parameters to your web service


There are many online tutorials on how to create use and consume web services from within your APEX applications so I will not go into it in this post.

What I recently have been asked was how do I pass multiple parameters to my web services?

I thought there must be a web site that gives you these details but I guess lot of it is assumed these days so writing this down to help those who did not get the grip first way around. 

So after creating a web service like:
   
with no params, the way you feed it with multiple parameters is that you redefine its URI template to something similar to this:
Please note {param1},{param2} syntax. 

This is the key. So for one parameter you only need /{param1} for more you simply comma separate them like in example above. Now in order to run it you can go into a GET -> query source select and set bind variable and clicking test. 

Along the result set example what you would get is a URL pattern that than can be used in your app.
https://apexrnd.be/apex/demo/mylist/1,DEMO,1001,1,1,10,LINO,90009
Of course all of these parameters need to be replaced with real data values. For example if I would run this on page 9 of my application this could be:
https:///apexrnd.be/apex/demo/mylist/&P9_PROG_END.,&P9_PROG_NAME.,&P9_PROG_ID.,...

Happy APEXing,
Lino

No comments:

Post a Comment