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.

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/

The Sync API workflow

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.

Configuring a Sync API request

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
       }
   }]
}
parametertypedescriptionrequired
timeoutnumberThe maximum time to wait for a response. The default is 60 seconds.No
opsJSON ObjectA list enclosing all the tasks to run on MPO.Yes
ops[].processIDnumberThe ID of the Process you want to run.Yes
ops[].typestringThe type of task. Usually ‘create’.Yes
ops[].objstringAn object type. Usually ‘task’.Yes
ops[].dataJSON ObjectAn 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"
}
parameterdescription
opsA list enclosing responses from all of the tasks run on MPO.
ops[].procReturns “ok” if a particular task runs successfully or errors if otherwise.
ops[].data.infoAn object with key-value pairs of the parameters returned from the task. Data specified for response in the API Call node.
request_procReturns “ok” if all the tasks ran successfully or errors if otherwise.