Automations
Answer a run that waits for your system
Hands a run whose Wait for step waits on another system what it waited for; the run carries on from there. 202 the run carries on, 404 no such run of this automation in this workspace, 409 the run isn’t waiting for a callback (already answered, or past its time limit).
Scope: automations.
POST
/
agents
/
{id}
/
runs
/
{runId}
/
callback
Answer a run that waits for your system
curl --request POST \
--url https://{workspace}.mercora.io/api/v1/agents/{id}/runs/{runId}/callback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payload": {
"fill_price": 2450,
"lots": 10
}
}
'import requests
url = "https://{workspace}.mercora.io/api/v1/agents/{id}/runs/{runId}/callback"
payload = { "payload": {
"fill_price": 2450,
"lots": 10
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({payload: {fill_price: 2450, lots: 10}})
};
fetch('https://{workspace}.mercora.io/api/v1/agents/{id}/runs/{runId}/callback', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{workspace}.mercora.io/api/v1/agents/{id}/runs/{runId}/callback",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'payload' => [
'fill_price' => 2450,
'lots' => 10
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{workspace}.mercora.io/api/v1/agents/{id}/runs/{runId}/callback"
payload := strings.NewReader("{\n \"payload\": {\n \"fill_price\": 2450,\n \"lots\": 10\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{workspace}.mercora.io/api/v1/agents/{id}/runs/{runId}/callback")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payload\": {\n \"fill_price\": 2450,\n \"lots\": 10\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{workspace}.mercora.io/api/v1/agents/{id}/runs/{runId}/callback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payload\": {\n \"fill_price\": 2450,\n \"lots\": 10\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "1c9e2f3a-4b5d-4e6f-9a0b-1c2d3e4f5a6b"
}{
"error": "<string>",
"issues": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"issues": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"issues": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"issues": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"issues": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"issues": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"issues": [
{
"field": "<string>",
"message": "<string>"
}
]
}Authorizations
A workspace API key (mk_…), made under Settings → Administration → API.
Path Parameters
The automation's id.
The run's id, as the run request returned it.
Body
application/json
What the run waited for. Its fields become the waiting step's values, which later steps pick by name.
Show child attributes
Show child attributes
Response
The run carries on.
The run's id.
⌘I
Answer a run that waits for your system
curl --request POST \
--url https://{workspace}.mercora.io/api/v1/agents/{id}/runs/{runId}/callback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payload": {
"fill_price": 2450,
"lots": 10
}
}
'import requests
url = "https://{workspace}.mercora.io/api/v1/agents/{id}/runs/{runId}/callback"
payload = { "payload": {
"fill_price": 2450,
"lots": 10
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({payload: {fill_price: 2450, lots: 10}})
};
fetch('https://{workspace}.mercora.io/api/v1/agents/{id}/runs/{runId}/callback', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{workspace}.mercora.io/api/v1/agents/{id}/runs/{runId}/callback",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'payload' => [
'fill_price' => 2450,
'lots' => 10
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{workspace}.mercora.io/api/v1/agents/{id}/runs/{runId}/callback"
payload := strings.NewReader("{\n \"payload\": {\n \"fill_price\": 2450,\n \"lots\": 10\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{workspace}.mercora.io/api/v1/agents/{id}/runs/{runId}/callback")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payload\": {\n \"fill_price\": 2450,\n \"lots\": 10\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{workspace}.mercora.io/api/v1/agents/{id}/runs/{runId}/callback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payload\": {\n \"fill_price\": 2450,\n \"lots\": 10\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "1c9e2f3a-4b5d-4e6f-9a0b-1c2d3e4f5a6b"
}{
"error": "<string>",
"issues": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"issues": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"issues": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"issues": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"issues": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"issues": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"issues": [
{
"field": "<string>",
"message": "<string>"
}
]
}