API Response Activity¶
The API Response activity can be configured using a JSON, XML, CSV, or XSD schema. To interact with an API connection using a WSDL schema, use an API SOAP Response activity instead.
For information on the relationship between API connector activities and API Manager APIs, see these resources:
Create an API Response Activity¶
An instance of an API Response activity is created from the preconfigured API connection using its Response activity type.
To create an instance of an activity, drag the activity type to the design canvas or copy the activity type and paste it on the design canvas. For details, see Creating an Activity Instance in Component Reuse.
An existing API Response activity can be edited from these locations:
- The design canvas (see Component Actions Menu in Design Canvas).
- The project pane's Components tab (see Component Actions Menu in Project Pane Components Tab).
Configure an API Response Activity¶
Follow these steps to configure an API Response activity:
Step 1: Enter a Name and Specify a Request Schema Preference
Provide a name for the activity and select a request schema preference.
Step 2: Review the Data Schemas
Any request or response schemas generated from the endpoint are displayed.
Step 1: Enter a Name and Specify a Request Schema Preference¶
In this step, provide a name for the activity and select a request schema preference. Each user interface element of this step is described below.
Name: Enter a name to identify the activity. The name must be unique for each API Response activity and must not contain forward slashes
Provide Request Schema: The request schema defines the structure of data that is used by the API Response activity. Whether a schema is required depends on if the API Response activity is used as the target of a transformation (see Schema Usage). For instructions on completing this section of activity configuration, refer to Schemas Defined in an Activity.
Save & Exit: If enabled, click to save the configuration for this step and close the activity configuration.
Next: Click to temporarily store the configuration for this step and continue to the next step. The configuration will not be saved until you click the Finished button on the last step.
Step 2: Review the Data Schemas¶
Any request or response schemas generated from the endpoint are displayed. Each user interface element of this step is described below.
- Data Schemas: The request and response schemas for this activity are displayed. These data schemas are inherited by adjacent transformations are displayed again during transformation mapping.
!!! note Data supplied in a transformation takes precedence over the activity configuration.
Add Plugin(s): Plugins are Jitterbit- or user-provided applications that extend Harmony's native capabilities. To apply a plugin to the activity, click to expand this section and select the checkbox next to the plugin to be used. For additional instructions on using plugins, including details on setting any required variables used by the plugin, see Plugins Added to an Activity.
Back: Click to temporarily store the configuration for this step and return to the previous step.
Finished: Click to save the configuration for all steps and close the activity configuration.
After configuring an API Response activity, you can use it within an operation as described below. Once the operation is set up, select it in the configuration of an API Manager Custom API to expose the operation or operation chain as a consumable REST endpoint.
Complete the Operation¶
Complete the configuration of the operation by adding and configuring other activities, transformations, or scripts as operation steps. You can also configure an operation's operation settings, which include the ability to chain operations together that are in the same or different workflows.
API Response activities can be used as a target with these operation patterns:
Two-target Archive Pattern (as the second target only)
Two-target HTTP Archive Pattern (as the second target only)
Two-transformation Pattern (as the second target only)
A typical use case is to use an API Response activity multiple times within an operation chain to handle different error responses. Both operations in this example use the Transformation Pattern.
In this example, in the operation Get Employee Data, the Validate Parameters script is used to provide input for a Database Query activity (Query Request), which generates a response structure that is received by the transformation (Database to API) and returned to the Custom API by an API Response activity (API Response).
On failure of the operation Get Employee Data, the operation Send Failure Response runs. The script Parse Failure Message is used to override the HTTP error code response for a Jitterbit Custom API using the Jitterbit variable
jitterbit.api.response.status_code and provides the input for the transformation Format Failure Response, which is then returned to the Custom API by an API Response activity (API Response):
- Cloud Agents: For API operations on a Cloud Agent, operation debug logging must be enabled on the operation.
- Private Agents: For API operations on a Private Agent, either operation debug logging must be enabled on the operation or you must set
[APIOperation]section of the Private Agent configuration file.
Other examples using API activities as targets in an operation include Capturing Data Changes with a Harmony API or HTTP Endpoint and Configure Outbound Messages with Harmony API. (These patterns use Design Studio as an example, but the same concepts can be applied in Cloud Studio.)
Configuring an API Manager Custom API¶
After you have configured a Custom API to call a Cloud Studio operation, you cannot delete the operation without either deleting the API or changing the API's configuration to no longer call the operation.