Simulate order type
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]."
}Order Type
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.
POST
/
order-type
/
{id}
/
simulate
Simulate order type
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]."
}Path Parameters
Body
application/json