curl --request PUT \
--url https://apiweb.mile.app/api/v3/automation/{automation_id} \
--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/{automation_id}"
payload = {
"name": "<string>",
"event": "<string>",
"automationType": "<string>",
"dataType": "<string>",
"isActive": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
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/{automation_id}', 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/{automation_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
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/{automation_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"event\": \"<string>\",\n \"automationType\": \"<string>\",\n \"dataType\": \"<string>\",\n \"isActive\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://apiweb.mile.app/api/v3/automation/{automation_id}")
.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/{automation_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.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 webhook automation",
"event": "onTaskFinished",
"automationType": "webhook",
"dataType": "task",
"automationDetails": {
"url": "https://apiweb.mile.app/webhook",
"headers": {
"x-api-key": "1234e98498ce07d29474a7ev2",
"org": "global"
}
},
"rules": {
"flow": "Pickup",
"flowId": "667b712f63020e5f182f0cb2"
},
"organizationId": "621dd813eb3ebf16b94dbde3",
"isActive": true,
"updatedTime": "2022-07-13T03:16:40+00:00",
"createdTime": "2022-07-13T03:16:40+00:00",
"_id": "62ce3918d3f3e1681a3a54b5"
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Data not found"
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Update automation by ID
curl --request PUT \
--url https://apiweb.mile.app/api/v3/automation/{automation_id} \
--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/{automation_id}"
payload = {
"name": "<string>",
"event": "<string>",
"automationType": "<string>",
"dataType": "<string>",
"isActive": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
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/{automation_id}', 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/{automation_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
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/{automation_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"event\": \"<string>\",\n \"automationType\": \"<string>\",\n \"dataType\": \"<string>\",\n \"isActive\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://apiweb.mile.app/api/v3/automation/{automation_id}")
.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/{automation_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.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 webhook automation",
"event": "onTaskFinished",
"automationType": "webhook",
"dataType": "task",
"automationDetails": {
"url": "https://apiweb.mile.app/webhook",
"headers": {
"x-api-key": "1234e98498ce07d29474a7ev2",
"org": "global"
}
},
"rules": {
"flow": "Pickup",
"flowId": "667b712f63020e5f182f0cb2"
},
"organizationId": "621dd813eb3ebf16b94dbde3",
"isActive": true,
"updatedTime": "2022-07-13T03:16:40+00:00",
"createdTime": "2022-07-13T03:16:40+00:00",
"_id": "62ce3918d3f3e1681a3a54b5"
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Data not found"
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Authorizations
Use a valid Bearer token to authenticate.
Path Parameters
Unique identifier for automation that generated by system.
Example: 62ce3918d3f3e1681a3a54b5
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