Skip to end of metadata
Go to start of metadata


This page uses operations set up in Design Studio as an example. Similar operations can be created using Cloud Studio.

IMPORTANT: When working with the files and operations that run asynchronously (such as when they are triggered as APIs), remember that Source/Target file names should be unique per run of the API. If you have multiple requests that fire off against the API at the same time, there is a chance the file will get overwritten if the filename is not unique.

Option 1: "No Response"

This is ideal if you can send and forget the request. The only response you will receive is an HTTP response of “202 Accepted”, which means Jitterbit Gateway has accepted the request but makes no guarantees about its processing.

Option 2: Final Target

This is ideal if the system you are working with expects a response in a specific format. It also allows you to provide final/dynamic verification of the operation's success. The way to optimize this is after the request has been received, send the response immediately then asynchronously continue processing the request. 

Example: In the example, we receive an ID in a query string and that ID is what is used in the Long Running Example.

The Transformation (Related to Red 1 in the operation figure above)

Scripts on the Response Element (Related to Red 3 in the operation figure above)

   RunOperation("<TAG>Operations/Long Running Example</TAG>",false);

You can also use the following—if you are not using parameters—to save the body of the request for other operations:

   WriteFile("<TAG>Targets/Temp File</TAG>",  $jitterbit.api.request.body);

in place of

   $ = $;

The “Run Long Running Example” script calls the long running operation asynchronously so that the response is returned to the requesting system after you save out the variables or data that you will need later on in your operation.

Option 3: System Variable

See API Jitterbit Variables for the complete list of API system variables.

This option responds to the requesting system with whatever is in $jitterbit.api.response variable. Again, the idea is that we want to set the variable and call other operations asynchronously so that the requesting system gets a response very quickly. 

Example: In this example, we are taking in a JSON file from the API call and in the transformation we are verifying that they are sending “search” as the type.

In the transformation we are looking at the type to verify if it is a type we want to support. The rest of the data elements are kept so that it will be saved in the file for use later on. Transformation notated by Red 1.

Type Node script (Script notated by Red 3 in transformation figure above)

   if(json$type$ == "search", 
   $jitterbit.api.response = "successful"; 
   $jitterbit.api.response = "Only Search is Currently Supported"; 

Finally the script at the end of the first transaction takes a look at the value of $jitterbit.api.response to make sure we received something we would like to process.

Script (Script notated by Red 2 in the operation figure above)

   if($jitterbit.api.response == "successful",
   RunOperation("<TAG>Operations/Long Running Example</TAG>",false); 
On This Page

Last updated:  May 15, 2019