Question

Send REST API call from context menu using API Key Auth

  • 13 September 2021
  • 4 replies
  • 556 views

Badge +4

I need a ‘Right-Click’ action that calls an external API endpoint using an API key. 

Here’s the scenario:
We have created a custom logical unit table that stores incoming prospect information from our website displayed in a grid. I have created a custom context menu option (Push to Salesforce) that pops up correctly, but what I need to do is attach an action to that click that pulls specific column data from the row, and calls the API endpoint (https://test.endpointurl.com/v1/customer/{person_id}).

 

It’s a GET method that accepts the PERSON_ID from the data row that was clicked. 

I’ve found a few posts that discuss how to call the REST API using the PL/SQL BLOCK method, but none address my two specific challenges:

  1. How to implement the API Key, not basic or bearer authorization
  2. How to pass column data into the parameters

Any guidance would be appreciated. 


This topic has been closed for comments

4 replies

Userlevel 4
Badge +8

Is your API key a static value or do you need to perform an authentication flow first?

 

Do you need IFS to process the response from the GET call?

Badge +4

Is your API key a static value or do you need to perform an authentication flow first?

 

Do you need IFS to process the response from the GET call?

Yes, the API Key is static, but processing the response is not really necessary. Even though it is a GET request, I’m not actually retrieving any pertinent data. I’m simply passing the Person_Id to the endpoint so Salesforce can link the contact in IFS to the correct account in SF. If it is easy to get back a status to let me know if the connection was successful, then I would welcome that, but since we are trying to get this deployed in 2 days, I will gladly add that in the next sprint if it complicates the solution. 

Userlevel 7
Badge +30

Hi @Anushka Kumar @Anne Fernando,
Could you please check if you can help on this.
Thanks & Best Regards,
Yasas 

Userlevel 6
Badge +15

Hi @Hotdog,
 

As I remember, in the custom menu screen, you should be able to use all the columns of the source window with the relevant SQL column identifier as follows,
eg URL: http://www.myintranet.com/purchasingroutines.htm?company=#USER_COMPANY#&&site={&CONTRACT}

Quote from the documentation,
"""
For menus with action type URL, PL/SQL Block and External Program it is possible to use field values in a form, and context substitution variables in the Parameter field. The values can be used as parameters in a URL, as bind variables in a PL/SQL block and as parameters to an external program. The syntax rule is ## for context substitution variables and & for form fields. In URLs the form field parameter should be additionally enclosed in curly braces ({&}) .
"""

Documentation link : https://docs.ifs.com/techdocs/foundation1/040_administration/220_user_interface/020_custom_objects/020_custom_menus/#How_to_use_form_data_in_parameters


Hope this helps ! ☺️
 

Cheers !
Udeera Dhananjaya Lekamge.