Skip to main content
Version: Next

ApiConnectActivity

Category: Common Steps Namespace: CMS.Plugin.FlowManagement.Domain.FlowBusiness.Activitys Base Class: BusinessActivity Module: FlowManagement.Domain

Overview​

ApiConnectActivity (Request API) is a node used to directly send HTTP requests in a flow. Unlike ApiCallActivity, it does not rely on pre-configured APIs in System Interconnection, but instead directly configures all details of the HTTP request, including URL, request method, headers, Query parameters, Body parameters, etc. This makes it more flexible and suitable for quick integration of external interfaces or testing API connections.

ApiConnectActivity supports GET, POST, PUT, DELETE methods, supports dynamic parameter retrieval from flow context, and can parse JSON response data to extract specified fields into the flow context.

Business Scenarios​

Applicable Scenarios​

  • Quick Integration: Directly call external APIs in the flow without configuring in System Interconnection
  • API Testing: Test connectivity and response of external APIs
  • Dynamic URL: Dynamically build request URLs based on flow data
  • RESTful API: Call standard RESTful API interfaces
  • Temporary Integration: Temporary API calls that do not require long-term maintenance

Role in the System​

ApiConnectActivity acts as a flexible HTTP client in the LMES flow system:

  • Sends HTTP requests directly to external systems
  • Supports multiple HTTP methods (GET, POST, PUT, DELETE)
  • Dynamically builds request parameters
  • Parses JSON response data
  • Handles request exceptions

Collaboration with Other Nodes​

  • BusinessActivity: Prepare parameters before API request and process response after request
  • ApiCallActivity: Similar function, but ApiCallActivity uses pre-configured APIs
  • Other Nodes: Can chain multiple API requests to implement complex integration scenarios

Configuration Instructions​

Basic Configuration​

Property NameTypeRequiredDefault ValueDescription
HttpMethodFlowHttpMethodYes-Request Method (GET/POST/PUT/DELETE)
UrlstringYes"http://"Request URL
RequestTimeOutintYes30Request Timeout (seconds)
QueryHttpParameterModelsNoEmpty CollectionQuery Parameters
BodyHttpParameterModelsNoEmpty CollectionBody Parameters
BodyContextstringNo-Body Flow Context Key
HeadersHttpParameterModelsNoEmpty CollectionHeader Parameters
ResponseHttpParameterModelsNoEmpty CollectionResponse Parameter Configuration
ExceptionContextstringNo-Request Exception Flow Context Key

Configuration Details​

HttpMethod​

Description: HTTP request method, determines which HTTP verb to use.

Value Range:

  • HttpGet: GET request, used for querying data
  • HttpPost: POST request, used for creating data
  • HttpPut: PUT request, used for updating data
  • HttpDelete: DELETE request, used for deleting data

Notes:

  • GET and DELETE requests do not support Body parameters
  • Body of POST and PUT requests will be sent in JSON format

Url​

Description: Target URL address. Supports placeholders {ParameterName} in the URL, which will be automatically replaced by Query parameter values.

Value Range: Valid HTTP/HTTPS URL

Notes:

  • Can be dynamically obtained from flow context: Flow.DataItems["NodeName_Url"] (NodeName is the value of the Name property)
  • Supports URL templates: http://api.example.com/users/{userId}
  • Query parameters will be automatically appended to the URL

RequestTimeOut​

Description: Request timeout in seconds. Throws timeout exception if no response received within this time.

Value Range: Integer greater than 0

Notes:

  • Default 30 seconds, adjust based on actual API response time
  • Timeout throws an exception which needs to be handled in the flow

Query​

Description: Query parameter collection, appended to the URL as a query string.

Parameter Model:

  • ParameterName: Parameter name
  • ParameterValue: Parameter value (supports flow context retrieval)
  • Description: Parameter description

Notes:

  • If parameter name exists as a placeholder in URL, it replaces the placeholder instead of appending
  • Parameter values are automatically URL encoded

Body​

Description: Body parameter collection, sent as JSON request body (POST and PUT only).

Parameter Model:

  • ParameterName: Parameter name
  • ParameterValue: Parameter value (supports flow context retrieval)
  • Description: Parameter description

Notes:

  • Only valid for POST and PUT requests
  • Parameters are serialized as JSON object
  • Content-Type automatically set to application/json

BodyContext​

Description: Body flow context identifier. If set, priority is given to getting data from flow context as request body instead of using Body parameter configuration.

Value Range: Key name in flow context

Notes:

  • Higher priority than Body parameter configuration
  • If value is string, used directly as request body
  • If value is object, serialized to JSON

Headers​

Description: Request header parameter collection.

Parameter Model:

  • ParameterName: Header name (e.g., Content-Type, Accept)
  • ParameterValue: Header value
  • Description: Parameter description

Notes:

  • Common headers: Content-Type, Accept, User-Agent, etc.
  • Authorization can be set via flow context {NodeName}_Authorization

Response​

Description: Response parameter configuration, defines how to extract data from API response.

Parameter Model:

  • ParameterName: Field path in response data (supports dot notation)
  • WriteParameterName: Key name to write to flow context
  • Description: Parameter description
  • DataType: Data type

Notes:

  • Only supports JSON format response
  • Supports nested field extraction (e.g., "data.user.name")
  • If response is array, automatically takes first element

ExceptionContext​

Description: Request exception flow context identifier. Exception message is written to this key when request fails.

Value Range: Key name in flow context

Notes:

  • Default uses {NodeName}_Exception if not set
  • Can check this key in subsequent nodes to determine if exception occurred

Flow Context​

Input Parameters​

Parameter NameTypeDescription
{NodeName}_UrlstringDynamically set request URL
{NodeName}_AuthorizationstringDynamically set authorization info
Query Parameter ValueanyFlow context value referenced in Query config
Body Parameter ValueanyFlow context value referenced in Body config
BodyContextanyComplete request body data

Output Parameters​

Parameter NameTypeDescription
{NodeName}_StatusCodeintHTTP response status code
{NodeName}_ResponsestringComplete response content
{NodeName}_ExceptionstringRequest exception message (if occurred)
{NodeName}_UrlstringActual request URL (including Query params)
Custom ParametersanyExtracted fields defined in Response config

Usage Examples​

Basic Example: GET Request​

{
"Type": "ApiConnectActivity",
"Name": "Get User Info",
"Alias": "GetUser",
"HttpMethod": "HttpGet",
"Url": "https://api.example.com/users/{userId}",
"RequestTimeOut": 30,
"Query": [
{
"ParameterName": "userId",
"ParameterValue": "{UserId_Value}"
}
],
"Response": [
{
"ParameterName": "data.name",
"WriteParameterName": "UserName_Value",
"DataType": "String"
},
{
"ParameterName": "data.email",
"WriteParameterName": "UserEmail_Value",
"DataType": "String"
}
]
}

Advanced Example: POST Request​

{
"Type": "ApiConnectActivity",
"Name": "Create Order",
"Alias": "CreateOrder",
"HttpMethod": "HttpPost",
"Url": "https://api.example.com/orders",
"RequestTimeOut": 60,
"Headers": [
{
"ParameterName": "Content-Type",
"ParameterValue": "application/json"
},
{
"ParameterName": "X-API-Key",
"ParameterValue": "{ApiKey_Value}"
}
],
"Body": [
{
"ParameterName": "customerId",
"ParameterValue": "{CustomerId_Value}"
},
{
"ParameterName": "productId",
"ParameterValue": "{ProductId_Value}"
},
{
"ParameterName": "quantity",
"ParameterValue": "{Quantity_Value}"
}
],
"Response": [
{
"ParameterName": "data.orderId",
"WriteParameterName": "OrderId_Value",
"DataType": "String"
},
{
"ParameterName": "data.status",
"WriteParameterName": "OrderStatus_Value",
"DataType": "String"
}
]
}

Notes​

  • ⚠️ Timeout Setting: Set reasonable timeout based on API response time
  • ⚠️ Exception Handling: API request failure does not interrupt flow, check exception key or status code
  • ⚠️ JSON Format: Response parameter extraction only supports JSON format
  • ⚠️ Request Body: POST and PUT request bodies are sent as JSON
  • ⚠️ URL Encoding: Query parameters are automatically URL encoded
  • ⚠️ Placeholders: URL placeholders must be defined in Query parameters
  • ⚠️ BodyContext Priority: Body parameter config is ignored if BodyContext is set

Update History​

DateVersionDescription
2025-11-281.0Initial version

Last updated: 2025-11-28