HTTP Action Documentation
The HTTP Action
component enables workflows to make HTTP requests to external services, APIs, and endpoints. This action allows for creating outbound HTTP connections with configurable methods, headers, and body parameters, enabling integration with third-party systems.
Overview
HTTP integration is a fundamental capability for any workflow system. In the Blocktrust Credential Workflow platform, the HTTP Action enables workflows to:
- Fetch data from external APIs
- Submit data to third-party services
- Trigger external processes
- Validate information through external sources
- Interact with webhook endpoints
This component serves as a bridge between your workflow platform and external web services, allowing for seamless integration with the broader web ecosystem.
Configuration Options
HTTP Method
The HTTP method to use for the request:
- GET: Retrieve data from the endpoint
- POST: Submit data to the endpoint
- PUT: Update existing resources at the endpoint
- DELETE: Remove resources at the endpoint
- PATCH: Partially update resources at the endpoint
The method selection impacts how the request is structured:
- GET and DELETE typically don’t include a request body
- POST, PUT, and PATCH typically include a request body
Endpoint
The URL or API endpoint to send the request to:
- Source:
- Static Value: Manually enter a specific URL
- From Trigger: Use a URL provided in the trigger parameters
- From Previous Action: Use a URL produced by a previous action in the workflow
- Value:
- For static sources: The specific URL to use (e.g.,
https://api.example.com/data
) - For trigger sources: Select the parameter name that contains the URL
- For action outcomes: Select the action that produced the URL
- For static sources: The specific URL to use (e.g.,
The endpoint should be a valid URL with the appropriate protocol (HTTP or HTTPS).
Headers
HTTP headers to include with the request:
- Header Name: The name of the HTTP header (e.g.,
Content-Type
,Authorization
) - Value Source:
- Static: A fixed value entered directly
- Trigger Input: Value from a trigger parameter
- Action Outcome: Value from a previous action result
- Value: The content of the header
Common headers you might configure include:
Content-Type
: Defines the format of the request body (e.g.,application/json
)Authorization
: Provides authentication credentialsAccept
: Specifies the expected response formatUser-Agent
: Identifies the client making the request
Request Body (for POST, PUT, PATCH methods)
When using POST, PUT, or PATCH methods, you can configure the request body:
- Field Name: The key in the JSON object to be sent
- Value Source:
- Static: A fixed value entered directly
- Trigger Input: Value from a trigger parameter
- Action Outcome: Value from a previous action result
- Value: The actual content for the field
The request body is constructed as a JSON object with the fields you define.
How It Works
When a workflow with an HTTP action is executed:
- The platform resolves the endpoint URL and all parameters
- It constructs the HTTP request with the specified method, headers, and body
- The request is sent to the specified endpoint
- The response is received and processed
- The response data is stored in the workflow context for potential use by subsequent actions
- The workflow continues based on the HTTP response
Technical Details
The HTTP action:
- Supports all standard HTTP methods (GET, POST, PUT, DELETE, PATCH)
- Automatically serializes request body fields into JSON for content types that require it
- Handles URL encoding and query parameter formatting for GET requests
- Processes HTTP status codes and response headers
- Supports both synchronous and asynchronous HTTP requests
Integration with Other Components
This action integrates with:
- Parameter Resolution System: To obtain dynamic values from various sources
- Workflow Context: Reads input parameters and stores operation results
- Error Handling: Provides detailed error information for failed requests
Use Cases
The HTTP action is ideal for:
- Data Retrieval: Fetch information from external APIs
- Example: Retrieve user data from a CRM system
- External Notifications: Send notifications to external systems
- Example: Post credential issuance events to a monitoring service
- Validation: Verify information through third-party services
- Example: Validate an address through a postal service API
- Integration: Connect workflows to external platforms
- Example: Submit credential data to a partner system
- Webhooks: Trigger events in external systems
- Example: Notify an external system when a credential is issued
Example Configurations
Basic GET Request
Retrieve data from an API:
- HTTP Method: GET
- Endpoint:
https://api.example.com/users/123
- Headers:
Accept
:application/json
Authorization
:Bearer {your-api-token}
POST Request with JSON Payload
Submit data to an API:
- HTTP Method: POST
- Endpoint:
https://api.example.com/credentials/verify
- Headers:
Content-Type
:application/json
Authorization
:Bearer {your-api-token}
- Body Fields:
credentialId
: Value from a trigger parameterissuerDid
: Value from a previous actioncheckRevocation
:true
(static)
PUT Request Updating a Resource
Update an existing resource:
- HTTP Method: PUT
- Endpoint:
https://api.example.com/users/123/preferences
- Headers:
Content-Type
:application/json
- Body Fields:
notificationEnabled
:true
language
: Value from a trigger parameter
Requirements and Dependencies
For the HTTP action to work properly:
- The workflow platform must have outbound network access to reach the specified endpoints
- For HTTPS endpoints, the platform must trust the endpoint’s SSL certificates
- Proper authentication credentials must be provided if the endpoint requires authentication
Troubleshooting
Common issues and solutions:
- Connection Failures: Ensure the endpoint is reachable and correctly spelled
- Authentication Errors: Verify that the proper authentication headers are included
- Request Format Issues: Check that the body format matches what the endpoint expects
- SSL/TLS Errors: Ensure the endpoint has a valid, trusted SSL certificate
- Timeout Errors: For slow endpoints, check if longer timeouts need to be configured
Security Considerations
When using the HTTP action:
- Avoid sending sensitive information like access tokens as query parameters
- Use HTTPS endpoints rather than HTTP when possible
- Consider using environment variables or secrets storage for authentication tokens
- Be aware of data retention policies for external services
- Validate and sanitize any data received from external sources before using it in subsequent actions