Reschedule a work
curl --request PUT \
--url https://{host}/api/public/v1/works/{id}/schedule \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"work_date": "2023-12-25",
"time_window_from": "<string>",
"time_window_to": "<string>",
"vehicle_id": 123
}
'import requests
url = "https://{host}/api/public/v1/works/{id}/schedule"
payload = {
"work_date": "2023-12-25",
"time_window_from": "<string>",
"time_window_to": "<string>",
"vehicle_id": 123
}
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({
work_date: '2023-12-25',
time_window_from: '<string>',
time_window_to: '<string>',
vehicle_id: 123
})
};
fetch('https://{host}/api/public/v1/works/{id}/schedule', 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://{host}/api/public/v1/works/{id}/schedule",
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([
'work_date' => '2023-12-25',
'time_window_from' => '<string>',
'time_window_to' => '<string>',
'vehicle_id' => 123
]),
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://{host}/api/public/v1/works/{id}/schedule"
payload := strings.NewReader("{\n \"work_date\": \"2023-12-25\",\n \"time_window_from\": \"<string>\",\n \"time_window_to\": \"<string>\",\n \"vehicle_id\": 123\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://{host}/api/public/v1/works/{id}/schedule")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"work_date\": \"2023-12-25\",\n \"time_window_from\": \"<string>\",\n \"time_window_to\": \"<string>\",\n \"vehicle_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/public/v1/works/{id}/schedule")
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 \"work_date\": \"2023-12-25\",\n \"time_window_from\": \"<string>\",\n \"time_window_to\": \"<string>\",\n \"vehicle_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {}
}{
"error": {
"code": "invalid_api_key",
"message": "The API key is invalid, revoked, or expired."
}
}{
"error": {
"code": "insufficient_scope",
"message": "This API key does not have the required scope."
}
}{
"error": {
"code": "not_found",
"message": "The requested resource was not found."
}
}{
"error": {
"code": "validation_failed",
"message": "The attention field is required.",
"fields": {
"attention": [
"The attention field is required."
]
}
}
}Works
Reschedule a work
Changes the date, time window or vehicle of a work. Send only the fields you want to change.
Requires the works:write scope.
PUT
/
works
/
{id}
/
schedule
Reschedule a work
curl --request PUT \
--url https://{host}/api/public/v1/works/{id}/schedule \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"work_date": "2023-12-25",
"time_window_from": "<string>",
"time_window_to": "<string>",
"vehicle_id": 123
}
'import requests
url = "https://{host}/api/public/v1/works/{id}/schedule"
payload = {
"work_date": "2023-12-25",
"time_window_from": "<string>",
"time_window_to": "<string>",
"vehicle_id": 123
}
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({
work_date: '2023-12-25',
time_window_from: '<string>',
time_window_to: '<string>',
vehicle_id: 123
})
};
fetch('https://{host}/api/public/v1/works/{id}/schedule', 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://{host}/api/public/v1/works/{id}/schedule",
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([
'work_date' => '2023-12-25',
'time_window_from' => '<string>',
'time_window_to' => '<string>',
'vehicle_id' => 123
]),
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://{host}/api/public/v1/works/{id}/schedule"
payload := strings.NewReader("{\n \"work_date\": \"2023-12-25\",\n \"time_window_from\": \"<string>\",\n \"time_window_to\": \"<string>\",\n \"vehicle_id\": 123\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://{host}/api/public/v1/works/{id}/schedule")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"work_date\": \"2023-12-25\",\n \"time_window_from\": \"<string>\",\n \"time_window_to\": \"<string>\",\n \"vehicle_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/public/v1/works/{id}/schedule")
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 \"work_date\": \"2023-12-25\",\n \"time_window_from\": \"<string>\",\n \"time_window_to\": \"<string>\",\n \"vehicle_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {}
}{
"error": {
"code": "invalid_api_key",
"message": "The API key is invalid, revoked, or expired."
}
}{
"error": {
"code": "insufficient_scope",
"message": "This API key does not have the required scope."
}
}{
"error": {
"code": "not_found",
"message": "The requested resource was not found."
}
}{
"error": {
"code": "validation_failed",
"message": "The attention field is required.",
"fields": {
"attention": [
"The attention field is required."
]
}
}
}Authorizations
An API key created in BeanRails, for example brk_live_....
Path Parameters
The record ID.
Body
application/json
New date, YYYY-MM-DD, in the workspace timezone.
Start of the time window, HH:mm. Required with time_window_to.
End of the time window, HH:mm. Must be after time_window_from.
Vehicle to assign, or null to unassign.
Response
The updated schedule of the work.
