Skip to main content

We are running Apps10 UPD8.  I see an option to call a Rest API in Custom Events.  I’m not seeing that option under Custom Menus.  Does anyone know if it’s possible to call a Rest API from a custom menu?

Hi @jhooperyan,

You can achieve this by setting the Custom Menu Action Type to "PL/SQL Block" and writing some PL/SQL code to invoke the following method,

Plsql_Rest_Sender_API.Call_Rest_EndPoint

Check the following f1doc link with a sample code,
Configure the REST Transport Connector

You might might need to check the below article on how to convert the above link to your customer specific f1doc URL,
How to access wit.ifsworld or docs.ifs links on this site

Cheers !
Dhananjaya.


There are two ways you can accomplish this. You can use an Event tied to an Event Action in UP8. Event Actions allow you to configure REST calls. Custom Menus do not. Therefore, you can also use the standard API directly in a custom menu using a PLSQL block. The script would look a little something like this:

 

declare

url_ Varchar2(500) := 'YOUR URL HERE';

text_ Varchar2(200) := 'YOUR JSON PAYLOAD HERE';

content_ Varchar2(30000);

 

rest_sender_ Varchar2(2000) := 'REST_SENDER1';

end_point_ Varchar2(32000) := 'YOUR ENDPOINT HERE';

auth_method_ varchar2(2000) := 'Basic';

http_method_ Varchar2(50) := 'POST';

query_params_ Varchar2(32000);

header_params_ Varchar2(32000);

login_info_ Varchar2(32000) := 'Authorization=Basic YOUR BASE64 ENCODED KEY HERE';

rest_message_ clob;

url_params_ varchar2(32000);

blob_info_ Varchar2(32000);

 

 

 

Begin

 

rest_message_ :=  '{ "text": "'|| text_ || '"}';

 

command_sys.Send_Rest_Message (

            rest_message_ ,

            end_point_     ,

            auth_method_   ,

            login_info_    ,

            rest_sender_   ,

            header_params_ ,

            url_params_    ,

            http_method_   ,

            blob_info_     ,

            query_params_  );

 

end;


Hi @jhooperyan,

You can achieve this by setting the Custom Menu Action Type to "PL/SQL Block" and writing some PL/SQL code to invoke the following method,

Plsql_Rest_Sender_API.Call_Rest_EndPoint

Check the following f1doc link with a sample code,
Configure the REST Transport Connector

You might might need to check the below article on how to convert the above link to your customer specific f1doc URL,
How to access wit.ifsworld or docs.ifs links on this site

Cheers !
Dhananjaya.

Thanks - I’ll take a look.  But it sounds like it might be simpler to use an RMB to set a value in a custom field and use the field change to trigger a custom event to call the API.


Hi @jhooperyan,

You can achieve this by setting the Custom Menu Action Type to "PL/SQL Block" and writing some PL/SQL code to invoke the following method,

Plsql_Rest_Sender_API.Call_Rest_EndPoint

Check the following f1doc link with a sample code,
Configure the REST Transport Connector

You might might need to check the below article on how to convert the above link to your customer specific f1doc URL,
How to access wit.ifsworld or docs.ifs links on this site

Cheers !
Dhananjaya.

Thanks - I’ll take a look.  But it sounds like it might be simpler to use an RMB to set a value in a custom field and use the field change to trigger a custom event to call the API.

Hi @jhooperyan,

You are welcome and I'm happy to help 😊

Cheers !
Dhananjaya.


There are two ways you can accomplish this. You can use an Event tied to an Event Action in UP8. Event Actions allow you to configure REST calls. Custom Menus do not. Therefore, you can also use the standard API directly in a custom menu using a PLSQL block. The script would look a little something like this:

 

declare

url_ Varchar2(500) := 'YOUR URL HERE';

text_ Varchar2(200) := 'YOUR JSON PAYLOAD HERE';

content_ Varchar2(30000);

 

rest_sender_ Varchar2(2000) := 'REST_SENDER1';

end_point_ Varchar2(32000) := 'YOUR ENDPOINT HERE';

auth_method_ varchar2(2000) := 'Basic';

http_method_ Varchar2(50) := 'POST';

query_params_ Varchar2(32000);

header_params_ Varchar2(32000);

login_info_ Varchar2(32000) := 'Authorization=Basic YOUR BASE64 ENCODED KEY HERE';

rest_message_ clob;

url_params_ varchar2(32000);

blob_info_ Varchar2(32000);

 

 

 

Begin

 

rest_message_ :=  '{ "text": "'|| text_ || '"}';

 

command_sys.Send_Rest_Message (

            rest_message_ ,

            end_point_     ,

            auth_method_   ,

            login_info_    ,

            rest_sender_   ,

            header_params_ ,

            url_params_    ,

            http_method_   ,

            blob_info_     ,

            query_params_  );

 

end;


Hello Paul,

Could you please explain how this api works ?

How can I know if the Rest call was succesfull ?

And where is the Json response ?

Thanks.

Luca


There are two ways you can accomplish this. You can use an Event tied to an Event Action in UP8. Event Actions allow you to configure REST calls. Custom Menus do not. Therefore, you can also use the standard API directly in a custom menu using a PLSQL block. The script would look a little something like this:

 

declare

url_ Varchar2(500) := 'YOUR URL HERE';

text_ Varchar2(200) := 'YOUR JSON PAYLOAD HERE';

content_ Varchar2(30000);

 

rest_sender_ Varchar2(2000) := 'REST_SENDER1';

end_point_ Varchar2(32000) := 'YOUR ENDPOINT HERE';

auth_method_ varchar2(2000) := 'Basic';

http_method_ Varchar2(50) := 'POST';

query_params_ Varchar2(32000);

header_params_ Varchar2(32000);

login_info_ Varchar2(32000) := 'Authorization=Basic YOUR BASE64 ENCODED KEY HERE';

rest_message_ clob;

url_params_ varchar2(32000);

blob_info_ Varchar2(32000);

 

 

 

Begin

 

rest_message_ :=  '{ "text": "'|| text_ || '"}';

 

command_sys.Send_Rest_Message (

            rest_message_ ,

            end_point_     ,

            auth_method_   ,

            login_info_    ,

            rest_sender_   ,

            header_params_ ,

            url_params_    ,

            http_method_   ,

            blob_info_     ,

            query_params_  );

 

end;


Hello Paul,

Could you please explain how this api works ?

How can I know if the Rest call was succesfull ?

And where is the Json response ?

Thanks.

Luca

This works similar to the way the REST Call type Event Action works and just like this Event Action you can find the messages in the Applications Messages view under IFS Connect.