Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

IG Dynamic Action - REST API

partlycloudyNov 1 2018 — edited Nov 2 2018

APEX 18.2

The Sample Interactive Grid has an example of using Dynamic Actions. I modified the example to add a Change handler on the Salary column that does the following

1. Take the least significant digit of the salary (sal%10)

2. Pass that to a dummy REST API like this one

3. Take the output from the REST API and do something with it

I can't figure out how to implement #3 above so I put the REST endpoint in a DIV instead.

It is an admittedly contrived example but the idea is to use client side credentials to do a GET/POST to a REST endpoint using some data from the IG model and do something with the response.

The REST capabilities that APEX provides are nice but the problem is that the Oracle database acts as the client and not the logged in user so managing credentials and passing them along to the REST endpoint is a hassle, especially with Windows/Kerberos in an Intranet type environment. Using jQuery $.ajax (or apex.server.process?) instead seems easier.

Does this make sense? Any ideas appreciated.

Thanks

Update: Made some progress, let me know if I am on the wrong track.

var val=$(this.triggeringElement).val();

var post_id=val%10;

var rest_url='https://jsonplaceholder.typicode.com/posts/'+post_id;

$.ajax({

   type: "GET",

   url: rest_url,

   dataType: "json",

   success:

      function(data){

         $('#rest_return').html(JSON.stringify(data));

      }

});

Comments
Post Details
Added on Nov 1 2018
12 comments
1,381 views