Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Occasionally, the need arises to use values created in one transformation in another transformation, for example, a sessionID returned from a login web service is required when calling subsequent web services for authentication purposes.

The need can also arise to use values created in one part of a transformation at a later stage in that transformation, for example, RecordNumber is initialized and incremented for every record inserted into a target to identify its item number.

Sometimes, we need to use values returned in one transformation in the definition settings of subsequent operations, for example, the URL setting returned by one transformation is used to set the Web Service URL of a subsequent web service call.

In all of these instances, you can use global variables to share the information in question with other parts of the operation or transformation. However, please note that global variables are only available for chained operations, that is, subsequent operations called from the operation that created the global variables using On Success and On Failure operation settings. Global Variables can also be used within the same transformation. See Using Global Variables for instructions to create global variables.

The following predefined API global variables are currently available in Jitterbit.

Variable Name

Data Type

Description

jitterbit.api.request.body

Introduction

This page covers Jitterbit variables that are available for Jitterbit Custom APIs, organized by informational variables that you get (read), and settings variables that you set (write):

Informational

Settings

Informational

jitterbit.api.request.body and jitterbit.api.request.body.*

Variablejitterbit.api.request.body and jitterbit.api.request.body.*

Data Type

String
Description

Looks at the payload/payloads submitted to the API. Note that for the majority of the APIs, you would expect only

expect

one plain payload and, as such, jitterbit.api.request.body is the variable to use (also known as content-type:text/plain).

If you expect multiple payloads to be submitted at once, using the URL-encoded form (also known as content-type:application/x-www-form-urlencoded), as in the case of an API being used as the backend of a submission form (see http://www.w3.org/TR/html401/interact/forms.html), then you should be using jitterbit.api.request.body.*. As with jitterbit.api.request.parameters.*, jitterbit.api.request.body.name will be equal to EStore if the value of the form's field "name" was entered as EStore.

jitterbit.api.request.enum.body

Variablejitterbit.api.request.enum.body

Data Type

String
DescriptionVariable array used to dynamically iterate through all of the submitted parts of the payload/body (versus checking a specific part as with jitterbit.api.request.body.*). The usage is the same as with the jitterbit.api.request.enum.parameters.

jitterbit.api.request.enum.headers

Variablejitterbit.api.request.enum.headers

Data Type

String
DescriptionVariable array used to dynamically iterate through all of the request headers (versus checking specific headers as with jitterbit.api.request.headers.*). The usage is the same as with the jitterbit.api.request.enum.parameters and jitterbit.api.request.enum.body.

jitterbit.api.request.enum.mvparameters

Variablejitterbit.api.request.enum.mvparameters

Data Type

String
DescriptionVariable array used to dynamically iterate through all of the multi-value parameters (as opposed to checking each parameter specifically as jitterbit.api.request.mvparameters.ProdID).

jitterbit.api.request.enum.parameters

Variable

jitterbit.api.request.enum.parameters

Data Type

String
Description

Variable array used to dynamically iterate through all of the submitted parameters (as opposed to checking each parameter specifically as jitterbit.api.request.parameters.name).

This sample script appends all of the provided parameters to a new variable for later display back to the user:

Code Block
<trans>
$output = "URL Parameters: <br>\r\n";
enum = $jitterbit.api.request.enum.parameters;
i = 0;
while(i<length(enum),
  name = enum[i];
  $output = $output + "$" + name + ": " + Get(name) + " <br>\r\n";
  i = i+1;
 );
if(i==0, $output = $output + "(none)<br>\r\n");
</trans>

jitterbit.api.request.headers.*

Variablejitterbit.api.request.headers.*

Data Type

String
DescriptionVariable used to look at the request headers submitted to the API; for example,
jitterbit
$jitterbit.api.request.headers.x_forwarded_for is the public IP of the box/user accessing the URL.

jitterbit.api.request.headers.fulluri

Variablejitterbit.api.request.headers.fulluri

Data Type

String
DescriptionThe URL that was called to trigger the Jitterbit OData or Custom API.

jitterbit.api.request.method

Variablejitterbit.api.request.method

Data Type

String
DescriptionThe request method that was used to call the API.

jitterbit.api.request.mvparameters.*

Variablejitterbit.api.request.mvparameters.*

Data Type

String
Description

Looks at the multi-values of the parameter submitted to the API directly via the URL and returns the values as an array with a space between each value.

Example: for

For example, if the URL is https://jitterbitxx.na.jitterbit.org/dev/ProductAPIResponse?ProdID=abc&ProdID=abc1&ProdID=abc2, then
jitterbit.api.request.mvparameters.ProdID will be abc abc1 abc2.

jitterbit.api.request.parameters.*

Variablejitterbit.api.request.parameters.*

Data Type

String
Description

Looks at the parameters submitted to the API directly via the URL; for example, jitterbit.api.request.parameters.name will be equal to EStore if the URL requested had &name=EStore.

Info
NOTE: Multi-value URL parameters will return a string delimited by
"
|||
"
(
three pipe symbols
3 pipes). To return multi-value URL parameters as an array, use the jitterbit.api.request.mvparameters.* variable instead.
Example of multi-value parameters: for

For example, if the URL is https://jitterbitxx.na.jitterbit.org/dev/ProductAPIResponse?ProdID=abc&ProdID=abc1&ProdID=abc2, then jitterbit.api.request.parameters.ProdID will be abc|||abc1|||abc2.

Settings

jitterbit.api.response

Variablejitterbit.api.response

Data Type

String
DescriptionThis variable needs to be set if your API is set to use a variable as the response instead of using the final target.

jitterbit.api.response.headers.*

Variablejitterbit.api.response.headers.*

Data Type

String
DescriptionUsed to set the response headers of the API
; for
. For example, set jitterbit.api.response.headers.access_control_allow_origin="*" to override default CORS behavior and allow the API to be accessed by any domain in a cross-site manner.

jitterbit.api.response.status_code

Variablejitterbit.operation.error

Data Type

String
DescriptionProvides the ability to override HTTP response code for custom APIs via Jitterbit script variable. Set the jitterbit.api.response.status_code variable in the script that is executed by a Custom API. This allows project authors to set a specific HTTP error code (along with actual payload information)
instead of
versus relying on the system to return codes 200 or 500 based on default behavior.
Panel
borderColor#FF7C4C
titleColor#FFFFFF
titleBGColor#FF7C4C
titleRelated Articles
Content by Label
showLabelsfalse
max1000
showSpacefalse
sorttitle
cqllabel = "global-variables" and space = "DOC"
Panel
borderColor#00B886
titleColor#FFFFFF
titleBGColor#00B886
titleRelated Topics
Content by Label
showLabelsfalse
max1000
showSpacefalse
sorttitle
cqllabel = "live-api-overview" and space = "DOC"

HideElements
metastrue

Last updated: 

Lastmodifieddate