Home‎ > ‎Site Admins‎ > ‎Blocks‎ > ‎

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:

A note on the configuration settings available:
  • API URL: The service you are sending data to.
  • API Method: either GET or POST. This is specified by the outside service's documentation.
  • POST content type: Typically this will be "application/json", but it could also be "application/x-www-form-urlencoded".
  • Parameters: defines what data you are sending. This can be either:
    • Literal Values: that you manually type in and are the same for every API Call. (Useful for API keys or static values).
    • Data Structure: this allows you to indicate that there is an object within the API call.
    • LegalServer matter variables: Various matter values are available, including all custom matter fields. 
  • Path Parameter: is a checkbox to determine whether the parameter is available in the URL as a path parameter. In the url it should be show up as a bracketed version of the Param Name. For example. if the url is http://localhost:9999/anything/{case_id} then {case_id} will be replaced with the parameter named case_id that has the Path Parameter checked. 
  • HTTP Headers: allows you to add specific headers in a comma separated set of keys and values. This is a great place to store authentication settings.
  • Client Certificate: for authentication purposes.
  • Store Response in a Note?: save the reponse 
    • Note Type: for the saved note
    • Note Subject: can be set specifically for this API call.
    • JSON params to pluck from response: this is a comma separated list of top level parameters to save in the case note. 
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.

Differences from Guided Navigation API Calls

There are a number of small differences between the two ways to send API calls from within LegalServer.
  1. The Generic Outgoing API Block allows for data structures to be passed as part of the API call.
  2. The Generic Outgoing API Block lets you set custom headers beyond those required for Authentication.
  3. The GN API Call allows you to store results from the API call in specific fields and not just as a note.