curl --request POST \
--url https://apiweb.mile.app/api/v3/automation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"event": "<string>",
"automationType": "<string>",
"dataType": "<string>",
"isActive": "<string>"
}
'import requests
url = "https://apiweb.mile.app/api/v3/automation"
payload = {
"name": "<string>",
"event": "<string>",
"automationType": "<string>",
"dataType": "<string>",
"isActive": "<string>"
}
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({
name: '<string>',
event: '<string>',
automationType: '<string>',
dataType: '<string>',
isActive: '<string>'
})
};
fetch('https://apiweb.mile.app/api/v3/automation', 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/v3/automation",
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([
'name' => '<string>',
'event' => '<string>',
'automationType' => '<string>',
'dataType' => '<string>',
'isActive' => '<string>'
]),
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/v3/automation"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"event\": \"<string>\",\n \"automationType\": \"<string>\",\n \"dataType\": \"<string>\",\n \"isActive\": \"<string>\"\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/v3/automation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"event\": \"<string>\",\n \"automationType\": \"<string>\",\n \"dataType\": \"<string>\",\n \"isActive\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/automation")
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 \"name\": \"<string>\",\n \"event\": \"<string>\",\n \"automationType\": \"<string>\",\n \"dataType\": \"<string>\",\n \"isActive\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success",
"data": {
"name": "Auto create task automation",
"event": "onTaskFinished",
"automationType": "createTask",
"dataType": "task",
"automationDetails": {
"flow": "Delivery",
"flowId": "667b75b29edc36517c609ac2",
"taskData": {
"customerName": "vasco",
"address": "Jakarta",
"description": "$refFlow.name"
}
},
"rules": {
"flow": "Pickup",
"flowId": "667b712f63020e5f182f0cb2",
"fields": {
"name": "roger",
"address": "kemayoran"
}
},
"organizationId": "621dd813eb3ebf16b94dbde3",
"isActive": true,
"updatedTime": "2022-07-13T03:16:40+00:00",
"createdTime": "2022-07-13T03:16:40+00:00",
"_id": "62ce3918d3f3e1681a3a54b1"
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Create automation
curl --request POST \
--url https://apiweb.mile.app/api/v3/automation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"event": "<string>",
"automationType": "<string>",
"dataType": "<string>",
"isActive": "<string>"
}
'import requests
url = "https://apiweb.mile.app/api/v3/automation"
payload = {
"name": "<string>",
"event": "<string>",
"automationType": "<string>",
"dataType": "<string>",
"isActive": "<string>"
}
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({
name: '<string>',
event: '<string>',
automationType: '<string>',
dataType: '<string>',
isActive: '<string>'
})
};
fetch('https://apiweb.mile.app/api/v3/automation', 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/v3/automation",
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([
'name' => '<string>',
'event' => '<string>',
'automationType' => '<string>',
'dataType' => '<string>',
'isActive' => '<string>'
]),
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/v3/automation"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"event\": \"<string>\",\n \"automationType\": \"<string>\",\n \"dataType\": \"<string>\",\n \"isActive\": \"<string>\"\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/v3/automation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"event\": \"<string>\",\n \"automationType\": \"<string>\",\n \"dataType\": \"<string>\",\n \"isActive\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/automation")
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 \"name\": \"<string>\",\n \"event\": \"<string>\",\n \"automationType\": \"<string>\",\n \"dataType\": \"<string>\",\n \"isActive\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success",
"data": {
"name": "Auto create task automation",
"event": "onTaskFinished",
"automationType": "createTask",
"dataType": "task",
"automationDetails": {
"flow": "Delivery",
"flowId": "667b75b29edc36517c609ac2",
"taskData": {
"customerName": "vasco",
"address": "Jakarta",
"description": "$refFlow.name"
}
},
"rules": {
"flow": "Pickup",
"flowId": "667b712f63020e5f182f0cb2",
"fields": {
"name": "roger",
"address": "kemayoran"
}
},
"organizationId": "621dd813eb3ebf16b94dbde3",
"isActive": true,
"updatedTime": "2022-07-13T03:16:40+00:00",
"createdTime": "2022-07-13T03:16:40+00:00",
"_id": "62ce3918d3f3e1681a3a54b1"
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Authorizations
Use a valid Bearer token to authenticate.
Body
Automation's name.
Example: Auto create task automation
Act as a trigger that start an automation. There are 10 different types.
enum: onTaskCreated, onTaskFinished, onTaskAssigned, onDataSourceCreated, onRoutingResultFinished, onRoutingResultDispatched, onStartTrip, onFinishTrip, onGeofenceEntry, onGeofenceLeave
onTaskCreated: Automation will happen when a task is created.
onTaskFinished: Automation will happen when a task is finished (status task: Done).
onTaskAssigned: Automation will happen when a task is assigned to field user(s).
onDataSourceCreated: Automation will happen when a data source is created.
onRoutingResultFinished: Automation will happen when a routing created is created.
onRoutingResultDispatched: Automation will happen when a routing is dispatched.
onStartTrip: Automation will happen when a start trip is triggered.
onFinishTrip: Automation will happen when a finish trip is triggered.
onGeofenceEntry: Automation will happen when a field worker enters a geofence and stays for its dwell time. Requires automationType: webhook and rules.fields.geofenceGroupId.
onGeofenceLeave: Automation will happen when a field worker leaves a geofence whose entry already fired. Requires automationType: webhook and rules.fields.geofenceGroupId.
Example: onTaskFinished
Automation's type. The changes you want to automate. There are 6 different types:
enum: createTask, createAssignTask, moveTask, assignTask, webhook, createOrUpdateDataSource, notification
createTask: The task will create when an event happens.
Example: createTask
Automation's data type. There are 4 different types.
enum: task, data, routingResult, locationHistory
Default: task
Automation's active state, only active automation will proceed by system
Default: true