You are viewing limited content. For full access, please sign in.

Question

Question

Can I use the REST api from within Forms to trigger an Oracle Orchestrator orchestration?

asked on December 29, 2021 Show version history

I'd like to take information from a submitted form and pass it to an Orchestration using the REST api.  I have examples of how to do this in Excel, but the data is coming from a submitted LF form.  Any suggestions as to how I might do this? 

 

0 0

Answer

SELECTED ANSWER
replied on December 29, 2021 Show version history

Here's an example:
It's multiple parts.  And it seems like every API does the authentication a little different (just have to troubleshoot and read their documentation really carefully).
This particular system requires me to do different POST calls to get a token and ID that is needed for each additional call after that:

  1. Login with a client ID and a secret key (which I'm populating from tokens).
  2. That returns a JSON response which includes an access key.
  3. I then have to use that access key to retrieve a organization ID.  It requires me to include the access key in the header.  Note that to get to the header details, you need to click the "gear" icon at the top of the activity's properties.

  4. That returns a JSON response which includes the ID.
  5. From there, I can complete various GET and POST calls, which all require me to include the access key and organization ID in the header.  Note that to get to the header details, you need to click the "gear" icon at the top of the activity's properties.

1 0

Replies

replied on December 29, 2021 Show version history

Workflow has several built-in activies that can work with APIs.  I've never worked specifically with Oracle, but I've accessed APIs from within Workflow to our ticketing system (BossDesk), the tracking/reporting system used by one of our security vendors (Sophos), and our Core (core is credit union speak for "account system").

It's not as powerful as coding a direct solution to the API (which I've also done with those same APIs and also DocuSign's API) but it's easier to implement.

Since Workflow can work with and manipulate the data submitted in the form, you should be able to handle it to the API from within Workflow.

2 0
replied on December 29, 2021

@████████: thanks for the reply.  I suspected I might need to use Workflow.  I've gone through the activities available in WF and the only one that seemed relevant is the Script activity.  I know enough about vb.net, having written lots of VBA code in Excel and Access, that I think I could write a routine that uses the Excel example I mentioned earlier as an outline of sorts.  Or, did you have a different WF activity in mind?

 

0 0
replied on December 29, 2021 Show version history

The activities in Workflow are "HTTP Form Post" and "HTTP Web Request".

Edit: and you'll likely need the "Read JSON" token to work with the returned data.

0 0
replied on December 29, 2021

Ok, I will look into those more closely.  I haven't used either one before, so I might be grasping at straws.  I'll check Answers to see if there are any examples, but if you have examples I would appreciate it!  Thanks.

 

1 0
SELECTED ANSWER
replied on December 29, 2021 Show version history

Here's an example:
It's multiple parts.  And it seems like every API does the authentication a little different (just have to troubleshoot and read their documentation really carefully).
This particular system requires me to do different POST calls to get a token and ID that is needed for each additional call after that:

  1. Login with a client ID and a secret key (which I'm populating from tokens).
  2. That returns a JSON response which includes an access key.
  3. I then have to use that access key to retrieve a organization ID.  It requires me to include the access key in the header.  Note that to get to the header details, you need to click the "gear" icon at the top of the activity's properties.

  4. That returns a JSON response which includes the ID.
  5. From there, I can complete various GET and POST calls, which all require me to include the access key and organization ID in the header.  Note that to get to the header details, you need to click the "gear" icon at the top of the activity's properties.

1 0
replied on April 18, 2022

Matthew,

I apologize for the delay in my reply.  I have a couple of questions:

  • What goes in the "Host" setting in the Web Service task?  Is it the URL for the server running the API (in this case, our Oracle server), or is it one of the already configured web services such as the Forms server?
  • What goes in the URI field in the Request section?  Is that for the URL to the API?

 

I don't think I need to send a request to the api for an authorization code; that appears to be already set up, at least according to my Oracle administrator.  So, I basically need to pass the authorization code (dummy example below), the body (which includes field names and values from the forms process), and get back the ResponseText which should validate that a record was created via the API call. 

An example of what this looks like when we run the API call from a SQL Server stored procedure is below (@URL is the URL to our Oracle server's API).  I'm looking to get the ResponseText in my LF Workflow in order to trigger another Forms process that needs the info from the API call.

:

EXEC sp_OACreate 'MSXML2.XMLHTTP', @Object OUT;
EXEC sp_OAMethod @Object, 'open', NULL, 'post', @URL, 'false'
EXEC sp_OAMethod @Object, 'setRequestHeader', null, 'Content-Type', 'application/json'
EXEC sp_OAMethod @Object, 'setRequestHeader', null, 'Authorization', 'Basic zzz123abc456yyyyxxx9876'
EXEC sp_OAMethod @Object, 'setRequestHeader', null, 'environment', 'JDV920'
EXEC sp_OAMethod @Object, 'setRequestHeader', null, 'role', '*All'
EXEC sp_OAMethod @Object, 'send', null, @body
EXEC sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT
EXEC sp_OADestroy @Object

0 0
replied on April 28, 2022

@████████ - hoping you have a moment to look at my last reply.  Thank you very much!

 

0 0
replied on April 28, 2022

The Host (configured from Web Service) and URI (set in the activity in Forms) fields combined are the URL that is being accessed for the API.

Let's say for example that your API is called via URLs like this:

https://www.fakesite.com/api/tenant/lookup

Then you'd likely want to set your Host as https://www.fakesite.com and the URI as /api/tenant/lookup.

The EXEC commands you listed don't seem to include the URL (the second one just lists @URL), so I can't speculate what you need to list for those values.

Four of the EXEC commands that you listed are header values - which Workflow does in the "Request Headers" section.  Look at my screenshot #3 - what I have listed there for authorization via a Bearer token, should be equivalent to the 4th EXEC command you have that is setting Basic authorization with a token.  You would set the Authorization header to be "Basic zzz123abc456yyyyxxx9876".  You should be able to set-up all four parts of the header that are shown in your EXEC commands 3-6.

0 0
replied on April 28, 2022 Show version history

Thanks for the clarification.  The URL being passed for the @URL parameter is http://xxx.com:9184/jderest/orchestrator/TA_FA_AP02_ORC_MatchPO (I replaced the host name with xxx), so it sounds like the host is http://xxx.com:9184  and the URI would be /jderest/orchestrator/TA_FA_AP02_ORC_MatchPO?

0 0
replied on April 28, 2022

Yes, I believe so.

0 0
replied on April 29, 2022

I can't set up the host using the domain I was given; it just returns a 404 error so I'll have to follow up with my E1 support team and possibly my VAR in order to go any further.  I appreciate your information and I'll accept one of your replies as the answer.  Thanks.

0 0
replied on April 29, 2022

Yeah, unfortunately, this part requires an awful lot of tweaking and testing to get right.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.