Update partially vehicle by ID
curl --request PATCH \
--url https://apiweb.mile.app/api/v3/vehicle/{vehicleId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Mini Van 35",
"assignee": "[email protected]",
"speed": 30,
"fixedCost": 15,
"tags": [
"Ganjil",
"Depok",
"B1124CC"
],
"workingTime": {
"startTime": "08:00",
"endTime": "17:00",
"multiday": 0
},
"breakTime": {
"startTime": "11:00",
"endTime": "11:30"
},
"capacity": {
"width": {
"min": 10,
"max": 1000
},
"heigh": {
"min": 10,
"max": 1000
}
},
"hubId": "621dd813eb3ebf16b94d6969"
}
'import requests
url = "https://apiweb.mile.app/api/v3/vehicle/{vehicleId}"
payload = {
"name": "Mini Van 35",
"assignee": "[email protected]",
"speed": 30,
"fixedCost": 15,
"tags": ["Ganjil", "Depok", "B1124CC"],
"workingTime": {
"startTime": "08:00",
"endTime": "17:00",
"multiday": 0
},
"breakTime": {
"startTime": "11:00",
"endTime": "11:30"
},
"capacity": {
"width": {
"min": 10,
"max": 1000
},
"heigh": {
"min": 10,
"max": 1000
}
},
"hubId": "621dd813eb3ebf16b94d6969"
}
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: 'Mini Van 35',
assignee: '[email protected]',
speed: 30,
fixedCost: 15,
tags: ['Ganjil', 'Depok', 'B1124CC'],
workingTime: {startTime: '08:00', endTime: '17:00', multiday: 0},
breakTime: {startTime: '11:00', endTime: '11:30'},
capacity: {width: {min: 10, max: 1000}, heigh: {min: 10, max: 1000}},
hubId: '621dd813eb3ebf16b94d6969'
})
};
fetch('https://apiweb.mile.app/api/v3/vehicle/{vehicleId}', 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/vehicle/{vehicleId}",
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' => 'Mini Van 35',
'assignee' => '[email protected]',
'speed' => 30,
'fixedCost' => 15,
'tags' => [
'Ganjil',
'Depok',
'B1124CC'
],
'workingTime' => [
'startTime' => '08:00',
'endTime' => '17:00',
'multiday' => 0
],
'breakTime' => [
'startTime' => '11:00',
'endTime' => '11:30'
],
'capacity' => [
'width' => [
'min' => 10,
'max' => 1000
],
'heigh' => [
'min' => 10,
'max' => 1000
]
],
'hubId' => '621dd813eb3ebf16b94d6969'
]),
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/vehicle/{vehicleId}"
payload := strings.NewReader("{\n \"name\": \"Mini Van 35\",\n \"assignee\": \"[email protected]\",\n \"speed\": 30,\n \"fixedCost\": 15,\n \"tags\": [\n \"Ganjil\",\n \"Depok\",\n \"B1124CC\"\n ],\n \"workingTime\": {\n \"startTime\": \"08:00\",\n \"endTime\": \"17:00\",\n \"multiday\": 0\n },\n \"breakTime\": {\n \"startTime\": \"11:00\",\n \"endTime\": \"11:30\"\n },\n \"capacity\": {\n \"width\": {\n \"min\": 10,\n \"max\": 1000\n },\n \"heigh\": {\n \"min\": 10,\n \"max\": 1000\n }\n },\n \"hubId\": \"621dd813eb3ebf16b94d6969\"\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/vehicle/{vehicleId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Mini Van 35\",\n \"assignee\": \"[email protected]\",\n \"speed\": 30,\n \"fixedCost\": 15,\n \"tags\": [\n \"Ganjil\",\n \"Depok\",\n \"B1124CC\"\n ],\n \"workingTime\": {\n \"startTime\": \"08:00\",\n \"endTime\": \"17:00\",\n \"multiday\": 0\n },\n \"breakTime\": {\n \"startTime\": \"11:00\",\n \"endTime\": \"11:30\"\n },\n \"capacity\": {\n \"width\": {\n \"min\": 10,\n \"max\": 1000\n },\n \"heigh\": {\n \"min\": 10,\n \"max\": 1000\n }\n },\n \"hubId\": \"621dd813eb3ebf16b94d6969\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/vehicle/{vehicleId}")
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\": \"Mini Van 35\",\n \"assignee\": \"[email protected]\",\n \"speed\": 30,\n \"fixedCost\": 15,\n \"tags\": [\n \"Ganjil\",\n \"Depok\",\n \"B1124CC\"\n ],\n \"workingTime\": {\n \"startTime\": \"08:00\",\n \"endTime\": \"17:00\",\n \"multiday\": 0\n },\n \"breakTime\": {\n \"startTime\": \"11:00\",\n \"endTime\": \"11:30\"\n },\n \"capacity\": {\n \"width\": {\n \"min\": 10,\n \"max\": 1000\n },\n \"heigh\": {\n \"min\": 10,\n \"max\": 1000\n }\n },\n \"hubId\": \"621dd813eb3ebf16b94d6969\"\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success",
"data": {
"name": "Mini Van 35",
"assignee": "[email protected]",
"speed": 30,
"fixedCost": 15,
"tags": [
"Ganjil",
"Depok",
"B1124CC"
],
"workingTime": {
"startTime": "08:00",
"endTime": "17:00",
"multiday": 0
},
"capacity": {
"width": {
"min": 10,
"max": 1000
},
"height": {
"min": 10,
"max": 1000
}
},
"organizationId": "621dd813eb3ebf16b94dbde3",
"hubId": "621dd813eb3ebf16b94d6969",
"updatedTime": "2022-07-13T03:16:40+00:00",
"createdTime": "2022-07-13T03:16:40+00:00",
"_id": "62ce3918d3f3e1681a3a54b2"
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Data not found"
}{
"status": false,
"message": "Internal server error, please contact [email protected]."
}Vehicle
Update partially vehicle by ID
maintenanceStartTime and maintenanceEndTime are not accepted: a request carrying either field is rejected with 400 and vehic-042. Record maintenance periods with POST /vehicle-maintenances.
PATCH
/
vehicle
/
{vehicleId}
Update partially vehicle by ID
curl --request PATCH \
--url https://apiweb.mile.app/api/v3/vehicle/{vehicleId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Mini Van 35",
"assignee": "[email protected]",
"speed": 30,
"fixedCost": 15,
"tags": [
"Ganjil",
"Depok",
"B1124CC"
],
"workingTime": {
"startTime": "08:00",
"endTime": "17:00",
"multiday": 0
},
"breakTime": {
"startTime": "11:00",
"endTime": "11:30"
},
"capacity": {
"width": {
"min": 10,
"max": 1000
},
"heigh": {
"min": 10,
"max": 1000
}
},
"hubId": "621dd813eb3ebf16b94d6969"
}
'import requests
url = "https://apiweb.mile.app/api/v3/vehicle/{vehicleId}"
payload = {
"name": "Mini Van 35",
"assignee": "[email protected]",
"speed": 30,
"fixedCost": 15,
"tags": ["Ganjil", "Depok", "B1124CC"],
"workingTime": {
"startTime": "08:00",
"endTime": "17:00",
"multiday": 0
},
"breakTime": {
"startTime": "11:00",
"endTime": "11:30"
},
"capacity": {
"width": {
"min": 10,
"max": 1000
},
"heigh": {
"min": 10,
"max": 1000
}
},
"hubId": "621dd813eb3ebf16b94d6969"
}
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: 'Mini Van 35',
assignee: '[email protected]',
speed: 30,
fixedCost: 15,
tags: ['Ganjil', 'Depok', 'B1124CC'],
workingTime: {startTime: '08:00', endTime: '17:00', multiday: 0},
breakTime: {startTime: '11:00', endTime: '11:30'},
capacity: {width: {min: 10, max: 1000}, heigh: {min: 10, max: 1000}},
hubId: '621dd813eb3ebf16b94d6969'
})
};
fetch('https://apiweb.mile.app/api/v3/vehicle/{vehicleId}', 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/vehicle/{vehicleId}",
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' => 'Mini Van 35',
'assignee' => '[email protected]',
'speed' => 30,
'fixedCost' => 15,
'tags' => [
'Ganjil',
'Depok',
'B1124CC'
],
'workingTime' => [
'startTime' => '08:00',
'endTime' => '17:00',
'multiday' => 0
],
'breakTime' => [
'startTime' => '11:00',
'endTime' => '11:30'
],
'capacity' => [
'width' => [
'min' => 10,
'max' => 1000
],
'heigh' => [
'min' => 10,
'max' => 1000
]
],
'hubId' => '621dd813eb3ebf16b94d6969'
]),
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/vehicle/{vehicleId}"
payload := strings.NewReader("{\n \"name\": \"Mini Van 35\",\n \"assignee\": \"[email protected]\",\n \"speed\": 30,\n \"fixedCost\": 15,\n \"tags\": [\n \"Ganjil\",\n \"Depok\",\n \"B1124CC\"\n ],\n \"workingTime\": {\n \"startTime\": \"08:00\",\n \"endTime\": \"17:00\",\n \"multiday\": 0\n },\n \"breakTime\": {\n \"startTime\": \"11:00\",\n \"endTime\": \"11:30\"\n },\n \"capacity\": {\n \"width\": {\n \"min\": 10,\n \"max\": 1000\n },\n \"heigh\": {\n \"min\": 10,\n \"max\": 1000\n }\n },\n \"hubId\": \"621dd813eb3ebf16b94d6969\"\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/vehicle/{vehicleId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Mini Van 35\",\n \"assignee\": \"[email protected]\",\n \"speed\": 30,\n \"fixedCost\": 15,\n \"tags\": [\n \"Ganjil\",\n \"Depok\",\n \"B1124CC\"\n ],\n \"workingTime\": {\n \"startTime\": \"08:00\",\n \"endTime\": \"17:00\",\n \"multiday\": 0\n },\n \"breakTime\": {\n \"startTime\": \"11:00\",\n \"endTime\": \"11:30\"\n },\n \"capacity\": {\n \"width\": {\n \"min\": 10,\n \"max\": 1000\n },\n \"heigh\": {\n \"min\": 10,\n \"max\": 1000\n }\n },\n \"hubId\": \"621dd813eb3ebf16b94d6969\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/vehicle/{vehicleId}")
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\": \"Mini Van 35\",\n \"assignee\": \"[email protected]\",\n \"speed\": 30,\n \"fixedCost\": 15,\n \"tags\": [\n \"Ganjil\",\n \"Depok\",\n \"B1124CC\"\n ],\n \"workingTime\": {\n \"startTime\": \"08:00\",\n \"endTime\": \"17:00\",\n \"multiday\": 0\n },\n \"breakTime\": {\n \"startTime\": \"11:00\",\n \"endTime\": \"11:30\"\n },\n \"capacity\": {\n \"width\": {\n \"min\": 10,\n \"max\": 1000\n },\n \"heigh\": {\n \"min\": 10,\n \"max\": 1000\n }\n },\n \"hubId\": \"621dd813eb3ebf16b94d6969\"\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success",
"data": {
"name": "Mini Van 35",
"assignee": "[email protected]",
"speed": 30,
"fixedCost": 15,
"tags": [
"Ganjil",
"Depok",
"B1124CC"
],
"workingTime": {
"startTime": "08:00",
"endTime": "17:00",
"multiday": 0
},
"capacity": {
"width": {
"min": 10,
"max": 1000
},
"height": {
"min": 10,
"max": 1000
}
},
"organizationId": "621dd813eb3ebf16b94dbde3",
"hubId": "621dd813eb3ebf16b94d6969",
"updatedTime": "2022-07-13T03:16:40+00:00",
"createdTime": "2022-07-13T03:16:40+00:00",
"_id": "62ce3918d3f3e1681a3a54b2"
}
}{
"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
Worker's email that assigned to the vehicle. One vehicle can only be assigned by one worker.
Example: [email protected]