curl --request POST \
--url https://apiweb.mile.app/api/v4/order-type/{id}/simulate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"order": {
"hubId": "64d9932e2beb9037735ff022",
"values": {
"orderNo": "EXP-0001",
"customerName": "Rina",
"weight": 2.5
}
},
"answers": {
"pickup": {
"receiverName": "Rina"
}
}
}
'import requests
url = "https://apiweb.mile.app/api/v4/order-type/{id}/simulate"
payload = {
"order": {
"hubId": "64d9932e2beb9037735ff022",
"values": {
"orderNo": "EXP-0001",
"customerName": "Rina",
"weight": 2.5
}
},
"answers": { "pickup": { "receiverName": "Rina" } }
}
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({
order: {
hubId: '64d9932e2beb9037735ff022',
values: {orderNo: 'EXP-0001', customerName: 'Rina', weight: 2.5}
},
answers: {pickup: {receiverName: 'Rina'}}
})
};
fetch('https://apiweb.mile.app/api/v4/order-type/{id}/simulate', 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://apiweb.mile.app/api/v4/order-type/{id}/simulate",
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([
'order' => [
'hubId' => '64d9932e2beb9037735ff022',
'values' => [
'orderNo' => 'EXP-0001',
'customerName' => 'Rina',
'weight' => 2.5
]
],
'answers' => [
'pickup' => [
'receiverName' => 'Rina'
]
]
]),
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://apiweb.mile.app/api/v4/order-type/{id}/simulate"
payload := strings.NewReader("{\n \"order\": {\n \"hubId\": \"64d9932e2beb9037735ff022\",\n \"values\": {\n \"orderNo\": \"EXP-0001\",\n \"customerName\": \"Rina\",\n \"weight\": 2.5\n }\n },\n \"answers\": {\n \"pickup\": {\n \"receiverName\": \"Rina\"\n }\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://apiweb.mile.app/api/v4/order-type/{id}/simulate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"order\": {\n \"hubId\": \"64d9932e2beb9037735ff022\",\n \"values\": {\n \"orderNo\": \"EXP-0001\",\n \"customerName\": \"Rina\",\n \"weight\": 2.5\n }\n },\n \"answers\": {\n \"pickup\": {\n \"receiverName\": \"Rina\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v4/order-type/{id}/simulate")
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 \"order\": {\n \"hubId\": \"64d9932e2beb9037735ff022\",\n \"values\": {\n \"orderNo\": \"EXP-0001\",\n \"customerName\": \"Rina\",\n \"weight\": 2.5\n }\n },\n \"answers\": {\n \"pickup\": {\n \"receiverName\": \"Rina\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success",
"data": {
"finished": true,
"finalStatus": "completed",
"path": {
"passed": [
"start",
"pickup",
"done"
],
"routes": [],
"edges": [
"start:next:pickup",
"pickup:next:done"
]
},
"steps": [
{
"order": 1,
"stepId": "start",
"state": "done",
"ports": [
"next"
],
"edges": [
{
"id": "pickup",
"from": "start:next"
}
]
},
{
"order": 3,
"stepId": "pickup",
"state": "waitingTask"
},
{
"order": 6,
"stepId": "pickup",
"state": "done",
"ports": [
"next"
],
"edges": [
{
"id": "done",
"from": "pickup:next"
}
]
},
{
"order": 8,
"stepId": "done",
"state": "done",
"ports": [],
"edges": []
}
],
"stoppedAt": [],
"log": [
{
"seq": 1,
"stepId": "start",
"event": "run.started",
"detail": {}
},
{
"seq": 3,
"stepId": "pickup",
"event": "task.created",
"detail": {
"taskIds": [
"6710b9e0a1b2c3d4e5f60718"
],
"row": 0,
"attempt": 1
}
},
{
"seq": 8,
"stepId": "done",
"event": "order.finished",
"detail": {}
}
],
"orderAfter": {
"status": "completed",
"values": {
"orderNo": "EXP-0001",
"customerName": "Rina",
"weight": 2.5
}
},
"warnings": []
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Data not found"
}{
"status": false,
"message": "Internal server error, please contact [email protected]."
}Simulate order type
Runs a test order through the order type’s steps without saving anything: no order, task or webhook is created. Requires permission edit/orderType.
Uses the stored draft, or the unsaved draft you send. Tasks are completed with the answers you give per step and webhooks with the outcome you give per step; a step without an answer waits.
The response shows the path taken (path, steps, log), where the run stopped (stoppedAt), the order after the run (orderAfter) and any warnings. When the draft has publish errors, checks is included too.
curl --request POST \
--url https://apiweb.mile.app/api/v4/order-type/{id}/simulate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"order": {
"hubId": "64d9932e2beb9037735ff022",
"values": {
"orderNo": "EXP-0001",
"customerName": "Rina",
"weight": 2.5
}
},
"answers": {
"pickup": {
"receiverName": "Rina"
}
}
}
'import requests
url = "https://apiweb.mile.app/api/v4/order-type/{id}/simulate"
payload = {
"order": {
"hubId": "64d9932e2beb9037735ff022",
"values": {
"orderNo": "EXP-0001",
"customerName": "Rina",
"weight": 2.5
}
},
"answers": { "pickup": { "receiverName": "Rina" } }
}
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({
order: {
hubId: '64d9932e2beb9037735ff022',
values: {orderNo: 'EXP-0001', customerName: 'Rina', weight: 2.5}
},
answers: {pickup: {receiverName: 'Rina'}}
})
};
fetch('https://apiweb.mile.app/api/v4/order-type/{id}/simulate', 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://apiweb.mile.app/api/v4/order-type/{id}/simulate",
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([
'order' => [
'hubId' => '64d9932e2beb9037735ff022',
'values' => [
'orderNo' => 'EXP-0001',
'customerName' => 'Rina',
'weight' => 2.5
]
],
'answers' => [
'pickup' => [
'receiverName' => 'Rina'
]
]
]),
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://apiweb.mile.app/api/v4/order-type/{id}/simulate"
payload := strings.NewReader("{\n \"order\": {\n \"hubId\": \"64d9932e2beb9037735ff022\",\n \"values\": {\n \"orderNo\": \"EXP-0001\",\n \"customerName\": \"Rina\",\n \"weight\": 2.5\n }\n },\n \"answers\": {\n \"pickup\": {\n \"receiverName\": \"Rina\"\n }\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://apiweb.mile.app/api/v4/order-type/{id}/simulate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"order\": {\n \"hubId\": \"64d9932e2beb9037735ff022\",\n \"values\": {\n \"orderNo\": \"EXP-0001\",\n \"customerName\": \"Rina\",\n \"weight\": 2.5\n }\n },\n \"answers\": {\n \"pickup\": {\n \"receiverName\": \"Rina\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v4/order-type/{id}/simulate")
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 \"order\": {\n \"hubId\": \"64d9932e2beb9037735ff022\",\n \"values\": {\n \"orderNo\": \"EXP-0001\",\n \"customerName\": \"Rina\",\n \"weight\": 2.5\n }\n },\n \"answers\": {\n \"pickup\": {\n \"receiverName\": \"Rina\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success",
"data": {
"finished": true,
"finalStatus": "completed",
"path": {
"passed": [
"start",
"pickup",
"done"
],
"routes": [],
"edges": [
"start:next:pickup",
"pickup:next:done"
]
},
"steps": [
{
"order": 1,
"stepId": "start",
"state": "done",
"ports": [
"next"
],
"edges": [
{
"id": "pickup",
"from": "start:next"
}
]
},
{
"order": 3,
"stepId": "pickup",
"state": "waitingTask"
},
{
"order": 6,
"stepId": "pickup",
"state": "done",
"ports": [
"next"
],
"edges": [
{
"id": "done",
"from": "pickup:next"
}
]
},
{
"order": 8,
"stepId": "done",
"state": "done",
"ports": [],
"edges": []
}
],
"stoppedAt": [],
"log": [
{
"seq": 1,
"stepId": "start",
"event": "run.started",
"detail": {}
},
{
"seq": 3,
"stepId": "pickup",
"event": "task.created",
"detail": {
"taskIds": [
"6710b9e0a1b2c3d4e5f60718"
],
"row": 0,
"attempt": 1
}
},
{
"seq": 8,
"stepId": "done",
"event": "order.finished",
"detail": {}
}
],
"orderAfter": {
"status": "completed",
"values": {
"orderNo": "EXP-0001",
"customerName": "Rina",
"weight": 2.5
}
},
"warnings": []
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Data not found"
}{
"status": false,
"message": "Internal server error, please contact [email protected]."
}Authorizations
Use a valid Bearer token to authenticate.
Path Parameters
Unique identifier for the order type that generated by system.
Example: 6710a2f4c1d2e3f4a5b6c7d8
Body
The test order: hubId (optional, must be a hub of your organization), values (checked against the draft fields) and optional externalRef (max 200 characters).
Optional unsaved draft (fields, statuses, configuration, orderSteps). When omitted, the stored draft is used (never the published version).
For an onTaskFinished trigger: answers, the finished task's answers the run starts from.
Answers per createTask step id, used to complete the simulated task. One object for every row, or { "rows": [ ... ] } per row. A step with no answer waits.
Outcome per callWebhook step id: { "outcome": "success" | "failed", "httpStatus"?, "response"? }. A step with no outcome waits.