Sync API
The Sync API allows you to make synchronous, blocking calls to the Mambu Process Orchestrator (MPO) by issuing calls to a sync server instead of the standard MPO base URL.
Requests to the standard MPO base URL return confirmation that the call was received, but the call is non-blocking for your application code. The process output is returned later as an additional response, or you must make another call to check its status.
When using the Sync API, process outputs are returned synchronously, and your request will be blocked waiting for process outputs.
Use the API Call node to invoke the Sync API.
We generally recommend using the standard asynchronous API when possible so your applications will not be blocked while your request is being handled.
How it works
Every MPO instance has a corresponding sync server with the following base URL:
https://TENANT_NAME-syncapi.mpo.mambu.com/
To make synchronous calls to MPO, issue calls to the sync server base URL.
You may also issue synchronous calls to your MPO sandbox using the following base URL:
https://TENANT_NAME-syncapi.sandbox.mpo.mambu.com/
Synchronous requests use the sync server as a middleman to make the request for you. Your request will be blocked until the process output is returned or the request times out.
Configuring a Sync API request in UI
To configure a synchronous request, you need to:
- Add the API Call node after the step from which you need an output.
- Provide the {{__callback_url}}.
- Specify the parameters which are to be sent to the task.
Generating an Sync API request
Once the process is set up to receive a Sync API request, send a request to the Sync Server to invoke a task. This synchronous request must include a signed hash to ensure that requests are coming from a known sender.
https://TENANT_NAME-syncapi.mambuonline.com/api/1/json/{mpoApiUser}/{unixTime}/{signature}
For more information on how to create a signature see API Basics.
Request Body
The request body must include the process ID of the task you want to invoke and any parameters you want to pass into the task. You may provide an optional timeout for the request, in seconds. If you do not specify a timeout, the default value of 60 seconds will be used.
Example
{
"timeout": 30,
"ops": [{
"processID": {{processID}},
"type": "create",
"obj": "task",
"data": {
"param": 1
}
}]
}
parameter | type | description | required |
---|---|---|---|
timeout | number | The maximum time to wait for a response. The default is 60 seconds. | No |
ops | JSON Object | A list enclosing all the tasks to run on MPO. | Yes |
ops[].processID | number | The ID of the Process you want to run. | Yes |
ops[].type | string | The type of task. Usually ‘create’. | Yes |
ops[].obj | string | An object type. Usually ‘task’. | Yes |
ops[].data | JSON Object | An object with key-value pairs of the parameters to pass into the task. | Yes |
Responses
{
"ops": [
{
"proc": "ok",
"data": {
"info": {
"param_1": "value_1",
"param_2": "value_2",
"param_3": "value_3"
}
}
}
],
"request_proc": "ok"
}
parameter | description |
---|---|
ops | A list enclosing responses from all of the tasks run on MPO. |
ops[].proc | Returns “ok” if a particular task runs successfully or errors if otherwise. |
ops[].data.info | An object with key-value pairs of the parameters returned from the task. Data specified for response in the API Call node. |
request_proc | Returns “ok” if all the tasks ran successfully or errors if otherwise. |