Generic Outgoing API Block

Purpose: Allow a LegalServer admin to, with custom coding, send information to an outside endpoint via API

Cost: This block is included with LegalServer.  For now, there is no charge for unlimited API calls.

Add the Generic Outgoing API block to any matter form, and it will automatically send an API call to the endpoint specified when the containing process is saved. This is one of two ways to send an API call from within LegalServer. The other method is to use Guided Navigation to make an API call.  

Please note that there is no indication on the user side of the form that this block is present. You may wish to add an Instruction to let users know that this API call will be made when the submit/continue button is clicked.

WARNING:  You must be sure you trust the outside service with your client's data.  

Generic Outgoing API Block Administrator Setup

To use this block, first identify the endpoint you will hit with the API call. You'll need to research what authentication is required, and you may have to sign up to get keys to use the outside API endpoint.

1) Add an Auxiliary Form with the Generic Outgoing API Block on it.

2) Configure the Generic Outgoing API Block

Here is an example configuration that will return a random taco recipe:

Note that the Parameters to Send (and potentially other fields) are not available when you first add the block to a form. You will have to save the form first and then reopen the block to edit those fields.

A note on the configuration settings available:

Especially when troubleshooting API issues, it is worth having "Store Response in a Note" set to true. 

3) Add the Form to a Process and the Process to the Actions Menu

4) Run the Process

5) Look at the Case Notes to see what the outside API endpoint returned.

6) Celebrate.


OAuth

If you need to use OAuth authentication, please file a ticket to request those features be enabled. Once we've enabled it, the Generic Outgoing API Block gains the following configuration values:


You'll have to then populate these fields. The Token URL allows you to identify the URL to get the OAuth Token from. The Username and password fields both need to be entered with the parameter name and the value. So if you need to submit a username, it would be "username:my_user_name" and the same with the password. To then parse the results, you'll need to enter in the value to get the token from. If the response looks like:

{ "access_token":"12345"}

You'll want to put "access_token" in the final field for the JSON path. 


jq Filters

For example with the jq filters, with a JSON API response of 

{   "_internal": {     "starttime": "2021-03-09T15:28:54.391312",     "steps": 1,     "steps_offset": 0,     "tracker": 1   },   "nav": {     "current": null,     "hidden": false,     "progressive": true }

Differences from Guided Navigation API Calls

There are a number of small differences between the two ways to send API calls from within LegalServer. Primarily, the Generic Outgoing API Block lets you set custom headers beyond those required for Authentication.