APIDirector

The APIDirector module is used to build and send REST API requests. With the APIDirector, any output from FormFusion may now be sent in one or multiple API calls to a specified endpoint.

Configuration

For information on the Execute this Director section, please see the FormDirector page.

Properties

The APIDirector Properties screen. Here you can format when to execute the director, configure page breaks, and select document format.

Variable Storage

The Variable Storage screen. Here, the fileName and id variables have been added, along with descriptions.

The APIDirector uses its own variable storage. Variables created here must be manually typed as they will not be available from the Variables Reference list. In addition, the variable names created here cannot match any variables names that exist in the Variables Reference list. They may only be used within the APIDirector for referencing other API responses for input with an HTTP Request.

Use the plus and minus buttons on the right side of the window in order to create or delete variables.

The variables stored here are only used when creating multiple, or subsequent, API calls. The variables are only valid once a value has been mapped to it in post-processing via the Response Body tab.

Note: All variables in the APIDirector are strings.

APIs

The APIs screen. Two requests have been added to the Requests field: Upload File, and Transfer File.

The plus and minus buttons on the right side of the window are used to add and delete requests, while the arrow buttons may be used to reorder the list. Reordering the requests here changes the order in which the requests are called. Depending on the Post Processing settings of each request this may change the outcome as some variables are reused for multiple requests.

New Request

The New Request screen. The request has been renamed to "Upload File", and a description added.

On the New Request tab, you may rename your request and add a description. The Details field shows what version of HTTPs is being used for the request.

Note: Renaming the request here will also change the name of the item in the tree.

Authentication

The Authentication screen. Basic Authentication has been selected, requiring a user name and password in order to execute the request.

On the Authentication tab, you may choose the request's authentication type. The default option is None, but selecting Basic Authentication reveals the Details pane where a User Name is required (the Password may also be set, but it not required) in order to run the API call.

Path

The Path screen. The request's URL destination has been added, and key and value pairs have been added to the parameters.

The request's destination is configured on the Path tab.

Under the Request Parameters field, Key and Value pairs are added to the URL in order to further configure and refine the destination of the API call.

Request Body

The Request Body screen, where data type options are form-data or Raw. The data type form-data has been selected, and key and value pairings have been added for the request body.

The default option is None, however the body of the request supports form-data and Raw data types.

Under form-data, key and value pairings may be added in the same way they were on the Path tab. Values added here however are passed into the body of the request instead of the URL destination.

Here, the Raw data type has been selected, and a JSON formatted request has been added to the request body.

The Raw data type option is used when more complex levels of data need to be passed to the request body.

Note: JSON is the only format supported for the Raw body type.

Response

The Response Body screen. Here, a sample response has been added for later reference.

On the Response Body tab, a sample API call response may be posted here if desired. This may be useful when samples are needed for reference at a later time.

Post Processing

The Post Processing screen. Values have been assigned to the id and fileName varibales created on the Variable Storage screen.

The Post Processing tab is where values are assigned to reference variables. Variables may be added or deleted using the plus and minus buttons on the right side of the pane. Variable assignment order can be modified by using the arrow buttons on the right side of the pane. The order here is only for reference of desired variable assignments or readability order.

Variables may only be reassigned within a single Post Processing request one time, however they can be reassigned in any other Post Processing request area again.

The Path field for Post Processing variable assignment supports dot/bracket JavaScript notation for setting the path to the value of the Post Processing variable. This can be useful for situations where the JSON key names contain spaces or special characters.

For example, the LastName value may be set using any of these formats:

data.Students[0].LastName

or,

["data"]["Students"][0]["LastName"]

or,

data.Students[0]["LastName"]

A backlash may be used for escaped notation (hex, octal, unicode, new line character, etc.). Since variables can be used in the path (using colon + varname), and the variable name converter also supports a backslash as an escape character, any escape characters in the path that are intended to remain after being processed by the variable name converter need to be double escaped.

Example: if we have Name. X, where there is a space between Name. and X, in order to access that field, the bracket notation would be: data.Students[0]["Name. X"]

An example of HEX escaped notation would be similar: data.Students[0]["Name.\x20X"] where \x20 is the "space" character in HEX.

Within FormFusion, the backslash needs to be escaped so it can make it through the variable converter.

Second Request

Some API calls are a two-step process and may require a second request (example: uploading a file, and transmitting the data). Subsequent requests may be filled out in the same manner as the first, and any variables created in post-processing of your first request may be easily used in the second.