Limit API Request Attempts
In this example, we will walk you through creating a process that throws an error after three unsuccessful calls to GET
all clients from the Mambu API. Mambu Process Orchestrator (MPO) does not have a built-in infinite loop protection rule for REST API requests that throw an exception due to the server unavailability, timeout, or overload; these are usually HTTP codes 500 Internal Server Error
, 502 Bad Gateway
, 503 Service Unavailable
, or 408 Request Timeout
.
Create the Process
1. Create an API consumer
Create an API consumer and generate an API key and a secret key in the Mambu UI. For more information on how to do this, see API Consumers.
2. Deploy the MPO Process
Download the process in the zip file below and deploy it to your MPO tenant.
3. Configure the MPO process
Find and open the config
state diagram in the View mode of the MPO UI. Trigger a task manually for this process and use the parameter values shown in the following JSON example:
{
"acceptHeader": "application/vnd.mambu.v2+json",
"apiKey": "Enter your API Key",
"noOfRetries": 3,
"url": "https://{TENANT_NAME}.mambu.com/api"
}
Enter the API key you generated in step 1, change noOfRetries
to suit your needs, and replace the url
with your Mambu tenant’s URL. Make sure to keep the /api
at the end of the address.
4. Retrieve configuration settings from another process
To include the configuration settings in another process, point to the config state diagram in a Set Parameter node before using the API Call node. To see this in practice, open the Mambu API: GET clients - v2
process and click the first Set Parameter node.
The value of the config field {{conv[@mbu-config].ref[config]}}
points to the alias of the state diagram configured in step 3. @mbu-config
is an alias of config state diagram.
5. Trigger the example
To trigger the example, open the Retrieve list of clients based on the status
process and set the state
in the Call Process node to active
.
The process will now throw an error and stop executing after three failed calls to the API endpoint.