Skip to main content
PATCH
/
automation
/
{automation_id}
Update partially automation by ID
curl --request PATCH \
  --url https://apiweb.mile.app/api/v3/automation/{automation_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Auto webhook automation",
  "event": "onTaskFinished",
  "isActive": false
}
'
import requests

url = "https://apiweb.mile.app/api/v3/automation/{automation_id}"

payload = {
"name": "Auto webhook automation",
"event": "onTaskFinished",
"isActive": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Auto webhook automation', event: 'onTaskFinished', isActive: false})
};

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 => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Auto webhook automation',
'event' => 'onTaskFinished',
'isActive' => false
]),
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\": \"Auto webhook automation\",\n \"event\": \"onTaskFinished\",\n \"isActive\": false\n}")

req, _ := http.NewRequest("PATCH", 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.patch("https://apiweb.mile.app/api/v3/automation/{automation_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Auto webhook automation\",\n \"event\": \"onTaskFinished\",\n \"isActive\": false\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::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Auto webhook automation\",\n \"event\": \"onTaskFinished\",\n \"isActive\": false\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": false,
    "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

Authorization
string
header
required

Use a valid Bearer token to authenticate.

Path Parameters

automation_id
string
required

Unique identifier for automation that generated by system. Example: 62ce3918d3f3e1681a3a54b5

Body

application/json
name
string

Automation's name. Example: Auto webhook automation

event
string

Act as a trigger that start an automation. There are 8 different types. enum: onTaskCreated, onTaskFinished, onTaskAssigned, onDataSourceCreated, onRoutingResultFinished, onRoutingResultDispatched, onStartTrip, onFinishTrip 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. Example: onTaskFinished

isActive
boolean

Automation's active state, only active automation will proceed by system Default: true

Response

Success

status
boolean

Status of response.

message
string

Message of API response.

data
object

Detail of object automation.