Update a Site
curl --request PATCH \
--url https://api.tread-horizon.com/v1/sites/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"address": {
"thoroughfare": "123 Fake St.",
"premise": "3rd Floor",
"locality": "New York",
"administrative_area": "NY",
"postal_code": "10011",
"country": "US",
"lat": "<string>",
"lon": "<string>",
"place_id": "<string>",
"_destroy": 123,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"name": "<string>",
"lat": "<string>",
"lon": "<string>",
"site_type": "Plant",
"notes": "<string>",
"next_billion_geofence": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"moving_geofence": false,
"_destroy": 123
},
"external_id": "<string>",
"moving_site": {
"equipment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"polling_interval_seconds": 123,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"_destroy": 123
},
"department_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contacts": [
{
"name": "<string>",
"email": "<string>",
"phone": "+18885551234",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"_destroy": 123
}
]
}
'import requests
url = "https://api.tread-horizon.com/v1/sites/{id}"
payload = {
"address": {
"thoroughfare": "123 Fake St.",
"premise": "3rd Floor",
"locality": "New York",
"administrative_area": "NY",
"postal_code": "10011",
"country": "US",
"lat": "<string>",
"lon": "<string>",
"place_id": "<string>",
"_destroy": 123,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"name": "<string>",
"lat": "<string>",
"lon": "<string>",
"site_type": "Plant",
"notes": "<string>",
"next_billion_geofence": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"moving_geofence": False,
"_destroy": 123
},
"external_id": "<string>",
"moving_site": {
"equipment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"polling_interval_seconds": 123,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"_destroy": 123
},
"department_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contacts": [
{
"name": "<string>",
"email": "<string>",
"phone": "+18885551234",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"_destroy": 123
}
]
}
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({
address: {
thoroughfare: '123 Fake St.',
premise: '3rd Floor',
locality: 'New York',
administrative_area: 'NY',
postal_code: '10011',
country: 'US',
lat: '<string>',
lon: '<string>',
place_id: '<string>',
_destroy: 123,
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
},
name: '<string>',
lat: '<string>',
lon: '<string>',
site_type: 'Plant',
notes: '<string>',
next_billion_geofence: {
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
moving_geofence: false,
_destroy: 123
},
external_id: '<string>',
moving_site: {
equipment_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
polling_interval_seconds: 123,
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
_destroy: 123
},
department_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
contacts: [
{
name: '<string>',
email: '<string>',
phone: '+18885551234',
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
_destroy: 123
}
]
})
};
fetch('https://api.tread-horizon.com/v1/sites/{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://api.tread-horizon.com/v1/sites/{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([
'address' => [
'thoroughfare' => '123 Fake St.',
'premise' => '3rd Floor',
'locality' => 'New York',
'administrative_area' => 'NY',
'postal_code' => '10011',
'country' => 'US',
'lat' => '<string>',
'lon' => '<string>',
'place_id' => '<string>',
'_destroy' => 123,
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'name' => '<string>',
'lat' => '<string>',
'lon' => '<string>',
'site_type' => 'Plant',
'notes' => '<string>',
'next_billion_geofence' => [
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'moving_geofence' => false,
'_destroy' => 123
],
'external_id' => '<string>',
'moving_site' => [
'equipment_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'polling_interval_seconds' => 123,
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'_destroy' => 123
],
'department_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'contacts' => [
[
'name' => '<string>',
'email' => '<string>',
'phone' => '+18885551234',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'_destroy' => 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://api.tread-horizon.com/v1/sites/{id}"
payload := strings.NewReader("{\n \"address\": {\n \"thoroughfare\": \"123 Fake St.\",\n \"premise\": \"3rd Floor\",\n \"locality\": \"New York\",\n \"administrative_area\": \"NY\",\n \"postal_code\": \"10011\",\n \"country\": \"US\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"place_id\": \"<string>\",\n \"_destroy\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"name\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"site_type\": \"Plant\",\n \"notes\": \"<string>\",\n \"next_billion_geofence\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"moving_geofence\": false,\n \"_destroy\": 123\n },\n \"external_id\": \"<string>\",\n \"moving_site\": {\n \"equipment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"polling_interval_seconds\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"_destroy\": 123\n },\n \"department_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contacts\": [\n {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"+18885551234\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"_destroy\": 123\n }\n ]\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://api.tread-horizon.com/v1/sites/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"address\": {\n \"thoroughfare\": \"123 Fake St.\",\n \"premise\": \"3rd Floor\",\n \"locality\": \"New York\",\n \"administrative_area\": \"NY\",\n \"postal_code\": \"10011\",\n \"country\": \"US\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"place_id\": \"<string>\",\n \"_destroy\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"name\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"site_type\": \"Plant\",\n \"notes\": \"<string>\",\n \"next_billion_geofence\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"moving_geofence\": false,\n \"_destroy\": 123\n },\n \"external_id\": \"<string>\",\n \"moving_site\": {\n \"equipment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"polling_interval_seconds\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"_destroy\": 123\n },\n \"department_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contacts\": [\n {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"+18885551234\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"_destroy\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tread-horizon.com/v1/sites/{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 \"address\": {\n \"thoroughfare\": \"123 Fake St.\",\n \"premise\": \"3rd Floor\",\n \"locality\": \"New York\",\n \"administrative_area\": \"NY\",\n \"postal_code\": \"10011\",\n \"country\": \"US\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"place_id\": \"<string>\",\n \"_destroy\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"name\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"site_type\": \"Plant\",\n \"notes\": \"<string>\",\n \"next_billion_geofence\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"moving_geofence\": false,\n \"_destroy\": 123\n },\n \"external_id\": \"<string>\",\n \"moving_site\": {\n \"equipment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"polling_interval_seconds\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"_destroy\": 123\n },\n \"department_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contacts\": [\n {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"+18885551234\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"_destroy\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"company": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tread_id": "ABC123",
"legal_name": "<string>",
"company_type": "hauler"
},
"name": "<string>",
"lat": "<string>",
"lon": "<string>",
"notes": "<string>",
"state": "active",
"external_id": "<string>",
"full_address": "<string>",
"routable": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"discarded_at": "2023-11-07T05:31:56Z",
"address": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"thoroughfare": "<string>",
"premise": "<string>",
"locality": "<string>",
"administrative_area": "<string>",
"postal_code": "<string>",
"country": "US",
"lat": "<string>",
"lon": "<string>",
"place_id": "<string>"
},
"site_type": "Plant",
"next_billion_geofence": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"geofence": {
"name": "<string>",
"type": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"geojson": {
"type": "<string>",
"coordinates": [
[
[
"<unknown>"
]
]
]
},
"circle_center": {
"lat": 123,
"lon": 123
},
"circle_radius": 123
},
"moving_geofence": false
},
"moving_site": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"equipment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"site_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"polling_interval_seconds": 123
},
"department": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"contacts": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"email": "<string>",
"phone": "+18885551234"
}
],
"editable": true,
"company_share": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>",
"ticket_match_id": "<string>",
"sender_company": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tread_id": "ABC123",
"legal_name": "<string>",
"company_type": "hauler"
},
"dispatchable": true,
"schedule_on": true,
"rate_override": true,
"expires_at": "2023-11-07T05:31:56Z"
}
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>",
"error_type": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
{
"model": "<string>",
"field": "<string>",
"message": "<string>"
}
]
}
}Sites
Update a Site
Update Site by ID
This endpoint required the ‘edit_site’ permission
PATCH
/
v1
/
sites
/
{id}
Update a Site
curl --request PATCH \
--url https://api.tread-horizon.com/v1/sites/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"address": {
"thoroughfare": "123 Fake St.",
"premise": "3rd Floor",
"locality": "New York",
"administrative_area": "NY",
"postal_code": "10011",
"country": "US",
"lat": "<string>",
"lon": "<string>",
"place_id": "<string>",
"_destroy": 123,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"name": "<string>",
"lat": "<string>",
"lon": "<string>",
"site_type": "Plant",
"notes": "<string>",
"next_billion_geofence": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"moving_geofence": false,
"_destroy": 123
},
"external_id": "<string>",
"moving_site": {
"equipment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"polling_interval_seconds": 123,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"_destroy": 123
},
"department_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contacts": [
{
"name": "<string>",
"email": "<string>",
"phone": "+18885551234",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"_destroy": 123
}
]
}
'import requests
url = "https://api.tread-horizon.com/v1/sites/{id}"
payload = {
"address": {
"thoroughfare": "123 Fake St.",
"premise": "3rd Floor",
"locality": "New York",
"administrative_area": "NY",
"postal_code": "10011",
"country": "US",
"lat": "<string>",
"lon": "<string>",
"place_id": "<string>",
"_destroy": 123,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"name": "<string>",
"lat": "<string>",
"lon": "<string>",
"site_type": "Plant",
"notes": "<string>",
"next_billion_geofence": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"moving_geofence": False,
"_destroy": 123
},
"external_id": "<string>",
"moving_site": {
"equipment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"polling_interval_seconds": 123,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"_destroy": 123
},
"department_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contacts": [
{
"name": "<string>",
"email": "<string>",
"phone": "+18885551234",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"_destroy": 123
}
]
}
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({
address: {
thoroughfare: '123 Fake St.',
premise: '3rd Floor',
locality: 'New York',
administrative_area: 'NY',
postal_code: '10011',
country: 'US',
lat: '<string>',
lon: '<string>',
place_id: '<string>',
_destroy: 123,
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
},
name: '<string>',
lat: '<string>',
lon: '<string>',
site_type: 'Plant',
notes: '<string>',
next_billion_geofence: {
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
moving_geofence: false,
_destroy: 123
},
external_id: '<string>',
moving_site: {
equipment_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
polling_interval_seconds: 123,
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
_destroy: 123
},
department_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
contacts: [
{
name: '<string>',
email: '<string>',
phone: '+18885551234',
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
_destroy: 123
}
]
})
};
fetch('https://api.tread-horizon.com/v1/sites/{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://api.tread-horizon.com/v1/sites/{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([
'address' => [
'thoroughfare' => '123 Fake St.',
'premise' => '3rd Floor',
'locality' => 'New York',
'administrative_area' => 'NY',
'postal_code' => '10011',
'country' => 'US',
'lat' => '<string>',
'lon' => '<string>',
'place_id' => '<string>',
'_destroy' => 123,
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'name' => '<string>',
'lat' => '<string>',
'lon' => '<string>',
'site_type' => 'Plant',
'notes' => '<string>',
'next_billion_geofence' => [
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'moving_geofence' => false,
'_destroy' => 123
],
'external_id' => '<string>',
'moving_site' => [
'equipment_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'polling_interval_seconds' => 123,
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'_destroy' => 123
],
'department_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'contacts' => [
[
'name' => '<string>',
'email' => '<string>',
'phone' => '+18885551234',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'_destroy' => 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://api.tread-horizon.com/v1/sites/{id}"
payload := strings.NewReader("{\n \"address\": {\n \"thoroughfare\": \"123 Fake St.\",\n \"premise\": \"3rd Floor\",\n \"locality\": \"New York\",\n \"administrative_area\": \"NY\",\n \"postal_code\": \"10011\",\n \"country\": \"US\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"place_id\": \"<string>\",\n \"_destroy\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"name\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"site_type\": \"Plant\",\n \"notes\": \"<string>\",\n \"next_billion_geofence\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"moving_geofence\": false,\n \"_destroy\": 123\n },\n \"external_id\": \"<string>\",\n \"moving_site\": {\n \"equipment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"polling_interval_seconds\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"_destroy\": 123\n },\n \"department_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contacts\": [\n {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"+18885551234\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"_destroy\": 123\n }\n ]\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://api.tread-horizon.com/v1/sites/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"address\": {\n \"thoroughfare\": \"123 Fake St.\",\n \"premise\": \"3rd Floor\",\n \"locality\": \"New York\",\n \"administrative_area\": \"NY\",\n \"postal_code\": \"10011\",\n \"country\": \"US\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"place_id\": \"<string>\",\n \"_destroy\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"name\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"site_type\": \"Plant\",\n \"notes\": \"<string>\",\n \"next_billion_geofence\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"moving_geofence\": false,\n \"_destroy\": 123\n },\n \"external_id\": \"<string>\",\n \"moving_site\": {\n \"equipment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"polling_interval_seconds\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"_destroy\": 123\n },\n \"department_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contacts\": [\n {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"+18885551234\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"_destroy\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tread-horizon.com/v1/sites/{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 \"address\": {\n \"thoroughfare\": \"123 Fake St.\",\n \"premise\": \"3rd Floor\",\n \"locality\": \"New York\",\n \"administrative_area\": \"NY\",\n \"postal_code\": \"10011\",\n \"country\": \"US\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"place_id\": \"<string>\",\n \"_destroy\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"name\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"site_type\": \"Plant\",\n \"notes\": \"<string>\",\n \"next_billion_geofence\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"moving_geofence\": false,\n \"_destroy\": 123\n },\n \"external_id\": \"<string>\",\n \"moving_site\": {\n \"equipment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"polling_interval_seconds\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"_destroy\": 123\n },\n \"department_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contacts\": [\n {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"+18885551234\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"_destroy\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"company": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tread_id": "ABC123",
"legal_name": "<string>",
"company_type": "hauler"
},
"name": "<string>",
"lat": "<string>",
"lon": "<string>",
"notes": "<string>",
"state": "active",
"external_id": "<string>",
"full_address": "<string>",
"routable": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"discarded_at": "2023-11-07T05:31:56Z",
"address": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"thoroughfare": "<string>",
"premise": "<string>",
"locality": "<string>",
"administrative_area": "<string>",
"postal_code": "<string>",
"country": "US",
"lat": "<string>",
"lon": "<string>",
"place_id": "<string>"
},
"site_type": "Plant",
"next_billion_geofence": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"geofence": {
"name": "<string>",
"type": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"geojson": {
"type": "<string>",
"coordinates": [
[
[
"<unknown>"
]
]
]
},
"circle_center": {
"lat": 123,
"lon": 123
},
"circle_radius": 123
},
"moving_geofence": false
},
"moving_site": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"equipment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"site_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"polling_interval_seconds": 123
},
"department": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"contacts": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"email": "<string>",
"phone": "+18885551234"
}
],
"editable": true,
"company_share": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>",
"ticket_match_id": "<string>",
"sender_company": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tread_id": "ABC123",
"legal_name": "<string>",
"company_type": "hauler"
},
"dispatchable": true,
"schedule_on": true,
"rate_override": true,
"expires_at": "2023-11-07T05:31:56Z"
}
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>",
"error_type": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
{
"model": "<string>",
"field": "<string>",
"message": "<string>"
}
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
The Accept-Language request HTTP header indicates the natural language and locale that the client prefers.
Example:
"en"
Path Parameters
Site ID
Body
application/json
Show child attributes
Show child attributes
Name of the site. Must be unique for a company.
Available options:
Plant, Quarry, JobSite, Depot, Other, Daily, EquipmentHomeBase Example:
"Plant"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
OK
Show child attributes
Show child attributes
⌘I