API Trigger Setup
API Triggers in the Workflow Management module allow users to automate actions based on specific API responses. This functionality enables integration with external services and systems by reacting to different HTTP methods and status codes.
Overview
API Triggers are configured to monitor and respond to specific API requests and their corresponding status codes. You can set up triggers for various HTTP methods, including GET, POST, PUT, and DELETE, each with their own status codes to indicate different outcomes.
Configuring API Triggers
Configure API Trigger for GET Method with 401 Status
To configure an API Trigger for unauthorized access:
- Title: Provide a descriptive title for the trigger.
- Description: Explain the purpose of the trigger.
- API Method: Select GET.
- Status: Set the status code to 401.
- API URL: Enter the API endpoint (e.g.,
api/v1/students
).
Example:
- Title: Unauthorized Student List Access
- Description: Trigger on unauthorized access to student list API
- API Method: GET
- Status: 401
- API URL: api/v1/students
Configure API Trigger for POST Method with 201 Status
To configure an API Trigger for successful creation:
- Title: Provide a descriptive title for the trigger.
- Description: Explain the purpose of the trigger.
- API Method: Select POST.
- Status: Set the status code to 201.
- API URL: Enter the API endpoint (e.g.,
api/v1/students
).
Example:
- Title: Successful Student Creation
- Description: Trigger on successful student creation via API
- API Method: POST
- Status: 201
- API URL: api/v1/students
Configure API Trigger for PUT Method with Custom Status
To configure an API Trigger for custom status updates:
- Title: Provide a descriptive title for the trigger.
- Description: Explain the purpose of the trigger.
- API Method: Select PUT.
- Status: Set the status code to a custom value (e.g., 409).
- API URL: Enter the API endpoint with path variables (e.g.,
api/v1/students/id
).
Example:
- Title: Custom Status Update
- Description: Trigger on custom status response for updating student information
- API Method: PUT
- Status: 409
- API URL: api/v1/students/id
Configure API Trigger for DELETE Method with 500 Status
To configure an API Trigger for server errors:
- Title: Provide a descriptive title for the trigger.
- Description: Explain the purpose of the trigger.
- API Method: Select DELETE.
- Status: Set the status code to 500.
- API URL: Enter the API endpoint with path variables (e.g.,
api/v1/students/id
).
Example:
- Title: Server Error on Student Deletion
- Description: Trigger on server error during student deletion
- API Method: DELETE
- Status: 500
- API URL: api/v1/students/id
Validating API Triggers
To validate the configuration of an API Trigger:
- Review Configuration: Ensure all fields are correctly filled with appropriate values.
- Check API Method and Status: Confirm that the correct HTTP method and status code are set.
Validation Checklist:
- Title
- Description
- API Method
- Status
- API URL
Verifying API Trigger Activation
Verify GET API Trigger Activation with 401 Status
To verify activation of a GET API trigger for unauthorized access:
- Trigger: Make an unauthorized GET request to
api/v1/students
. - API Response: The API should return a 401 status.
Expected Outcome:
- The API Trigger should be activated and verified as working correctly.
Verify POST API Trigger Activation with 201 Status
To verify activation of a POST API trigger for successful creation:
- Trigger: Make a successful POST request to
api/v1/students
. - API Response: The API should return a 201 status.
Expected Outcome:
- The API Trigger should be activated and verified as working correctly.
Verify PUT API Trigger Activation with Custom Status
To verify activation of a PUT API trigger for custom status updates:
- Trigger: Make a PUT request to
api/v1/students/id
resulting in a 409 status. - API Response: The API should return a 409 status.
Expected Outcome:
- The API Trigger should be activated and verified as working correctly.
Verify DELETE API Trigger Activation with 500 Status
To verify activation of a DELETE API trigger for server errors:
- Trigger: Make a DELETE request to
api/v1/students/id
resulting in a 500 status. - API Response: The API should return a 500 status.
Expected Outcome:
- The API Trigger should be activated and verified as working correctly.
Summary
API Triggers enable the Workflow Management module to automate actions based on various API responses. By configuring triggers for different HTTP methods and status codes, users can ensure their workflows respond appropriately to changes and issues in API interactions.