Create a new Site
curl --request POST \
--url https://api.tread-horizon.com/v1/sites \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"lat": "<string>",
"lon": "<string>",
"notes": "<string>",
"site_type": "Plant",
"company_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"next_billion_geofence": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"moving_geofence": false
},
"external_id": "<string>",
"full_address": "<string>",
"department_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contacts": [
{
"name": "<string>",
"email": "<string>",
"phone": "+18885551234"
}
]
}
'import requests
url = "https://api.tread-horizon.com/v1/sites"
payload = {
"name": "<string>",
"lat": "<string>",
"lon": "<string>",
"notes": "<string>",
"site_type": "Plant",
"company_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"next_billion_geofence": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"moving_geofence": False
},
"external_id": "<string>",
"full_address": "<string>",
"department_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contacts": [
{
"name": "<string>",
"email": "<string>",
"phone": "+18885551234"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
lat: '<string>',
lon: '<string>',
notes: '<string>',
site_type: 'Plant',
company_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
next_billion_geofence: {id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', moving_geofence: false},
external_id: '<string>',
full_address: '<string>',
department_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
contacts: [{name: '<string>', email: '<string>', phone: '+18885551234'}]
})
};
fetch('https://api.tread-horizon.com/v1/sites', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'lat' => '<string>',
'lon' => '<string>',
'notes' => '<string>',
'site_type' => 'Plant',
'company_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'next_billion_geofence' => [
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'moving_geofence' => false
],
'external_id' => '<string>',
'full_address' => '<string>',
'department_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'contacts' => [
[
'name' => '<string>',
'email' => '<string>',
'phone' => '+18885551234'
]
]
]),
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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"notes\": \"<string>\",\n \"site_type\": \"Plant\",\n \"company_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"next_billion_geofence\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"moving_geofence\": false\n },\n \"external_id\": \"<string>\",\n \"full_address\": \"<string>\",\n \"department_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contacts\": [\n {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"+18885551234\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.tread-horizon.com/v1/sites")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"notes\": \"<string>\",\n \"site_type\": \"Plant\",\n \"company_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"next_billion_geofence\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"moving_geofence\": false\n },\n \"external_id\": \"<string>\",\n \"full_address\": \"<string>\",\n \"department_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contacts\": [\n {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"+18885551234\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tread-horizon.com/v1/sites")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"notes\": \"<string>\",\n \"site_type\": \"Plant\",\n \"company_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"next_billion_geofence\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"moving_geofence\": false\n },\n \"external_id\": \"<string>\",\n \"full_address\": \"<string>\",\n \"department_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contacts\": [\n {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"+18885551234\"\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>",
"errors": [
{
"model": "<string>",
"field": "<string>",
"message": "<string>"
}
]
}
}Sites
Create a new Site
Create a new Site
POST
/
v1
/
sites
Create a new Site
curl --request POST \
--url https://api.tread-horizon.com/v1/sites \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"lat": "<string>",
"lon": "<string>",
"notes": "<string>",
"site_type": "Plant",
"company_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"next_billion_geofence": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"moving_geofence": false
},
"external_id": "<string>",
"full_address": "<string>",
"department_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contacts": [
{
"name": "<string>",
"email": "<string>",
"phone": "+18885551234"
}
]
}
'import requests
url = "https://api.tread-horizon.com/v1/sites"
payload = {
"name": "<string>",
"lat": "<string>",
"lon": "<string>",
"notes": "<string>",
"site_type": "Plant",
"company_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"next_billion_geofence": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"moving_geofence": False
},
"external_id": "<string>",
"full_address": "<string>",
"department_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contacts": [
{
"name": "<string>",
"email": "<string>",
"phone": "+18885551234"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
lat: '<string>',
lon: '<string>',
notes: '<string>',
site_type: 'Plant',
company_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
next_billion_geofence: {id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', moving_geofence: false},
external_id: '<string>',
full_address: '<string>',
department_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
contacts: [{name: '<string>', email: '<string>', phone: '+18885551234'}]
})
};
fetch('https://api.tread-horizon.com/v1/sites', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'lat' => '<string>',
'lon' => '<string>',
'notes' => '<string>',
'site_type' => 'Plant',
'company_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'next_billion_geofence' => [
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'moving_geofence' => false
],
'external_id' => '<string>',
'full_address' => '<string>',
'department_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'contacts' => [
[
'name' => '<string>',
'email' => '<string>',
'phone' => '+18885551234'
]
]
]),
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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"notes\": \"<string>\",\n \"site_type\": \"Plant\",\n \"company_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"next_billion_geofence\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"moving_geofence\": false\n },\n \"external_id\": \"<string>\",\n \"full_address\": \"<string>\",\n \"department_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contacts\": [\n {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"+18885551234\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.tread-horizon.com/v1/sites")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"notes\": \"<string>\",\n \"site_type\": \"Plant\",\n \"company_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"next_billion_geofence\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"moving_geofence\": false\n },\n \"external_id\": \"<string>\",\n \"full_address\": \"<string>\",\n \"department_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contacts\": [\n {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"+18885551234\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tread-horizon.com/v1/sites")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"lat\": \"<string>\",\n \"lon\": \"<string>\",\n \"notes\": \"<string>\",\n \"site_type\": \"Plant\",\n \"company_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"next_billion_geofence\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"moving_geofence\": false\n },\n \"external_id\": \"<string>\",\n \"full_address\": \"<string>\",\n \"department_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contacts\": [\n {\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"+18885551234\"\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>",
"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"
Body
application/json
Latitude of the site. If not provided, the latitude from the address will be used.
Longitude of the site. If not provided, the longitude from the address will be used.
Show child attributes
Show child attributes
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
Created
Show child attributes
Show child attributes
⌘I