API Request activity¶
Introduction¶
An API Request activity, using its preconfigured API connection, retrieves data when called by an API Manager custom API and is intended to be used as a source to provide data to an operation.
The API Request 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 Request activity instead.
For information on the relationship between API connector activities and API Manager APIs, see these resources:
Create an API Request activity¶
An instance of an API Request activity is created from the preconfigured API connection using its Request 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 Request 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 Request activity¶
Follow these steps to configure an API Request activity:
-
Step 1: Enter a name and specify a response schema preference
Provide a name for the activity and select a response 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 response schema preference¶
In this step, provide a name for the activity and select a response 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 Request activity and must not contain forward slashes
/
or colons:
. -
Provide Response Schema: The response schema defines the structure of data that is used by the API Request activity. Whether a schema is required depends on whether the API Request activity is used as the source of a transformation. For instructions on completing this section of activity configuration, refer to Schema usage and 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.
-
Discard Changes: After making changes, click to close the configuration without saving changes made to any step. A message asks you to confirm that you want to discard changes.
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.
-
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.
-
Discard Changes: After making changes, click to close the configuration without saving changes made to any step. A message asks you to confirm that you want to discard changes.
Next steps¶
After configuring an API Request activity, complete the configuration of the operation by adding and configuring other activities, transformations, or scripts as operation steps. You can also configure the operation settings, which include the ability to chain operations together that are in the same or different workflows.
Menu actions for an activity are accessible from the project pane and the design canvas. For details, see Activity actions menu in Connector basics.
API Request activities can be used as a source with these operation patterns:
-
Two-target archive pattern (as the first source only)
-
Two-target HTTP archive pattern (as the first source only)
-
Two-transformation pattern (as the first source only)
Note
Operations that begin with an API Request activity cannot be executed manually using the operation Deploy and Run or Run options. Instead, these operations require data that is provided when an API call is made using a custom API created through API Manager. An API may be called from an application or — if the API supports GET — you can paste the URL into a web browser to consume the API manually.
A typical use case is to use an API Request activity and an API Response activity in an operation chain, where the first operation is triggered by an API and the second operation runs on success of the first operation. Both operations in this example use the Transformation pattern.
In this example, an API triggers the operation Insert Customer Request to run. The API Request activity (API Request) generates a response structure that is received by the transformation (API to Database), which is then inserted in a database using a Database Insert activity (Insert Response).
On success of the operation Insert Customer Request, the operation Query Customer Response runs. A Database Query activity (Query Request) generates a response structure that is received by the transformation (Database to API), which is then returned to the API by an API Response activity (API Response):
When ready, deploy and run the operation and validate behavior by checking the operation logs.
Important
By default, successful operations configured for a custom API are not included in the operation logs unless one of these settings is enabled:
- 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
EnableLogging=true
in the[APIoperation]
section of the private agent configuration file.
Additional examples¶
Other examples using API activities as targets in an operation include Capturing data changes with an API Manager API or HTTP endpoint and Configure outbound messages with an API Manager API. (These patterns use Design Studio as an example, but the same concepts can be applied in Integration Studio.)
Configuring an API Manager custom API¶
After the operation setup is complete, configure a custom API using API Manager.
Note
After you have configured a custom API to call an Integration Studio operation, you cannot delete the operation without either deleting the API or changing the API's configuration to no longer call the operation.