Create
curl --request POST \
--url https://api.app.fleetit.com/v2/fleets/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "Fleet XYZ",
"is_active": true,
"regions": [
1,
2
],
"customer_info": {
"ext_client_id": "123456",
"ext_billing_id": "654321",
"service_types": [
"Tolls",
"Violations"
],
"email": "email@example.com",
"notes": "Detailed notes here"
}
}
'import requests
url = "https://api.app.fleetit.com/v2/fleets/"
payload = {
"title": "Fleet XYZ",
"is_active": True,
"regions": [1, 2],
"customer_info": {
"ext_client_id": "123456",
"ext_billing_id": "654321",
"service_types": ["Tolls", "Violations"],
"email": "email@example.com",
"notes": "Detailed notes here"
}
}
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({
title: 'Fleet XYZ',
is_active: true,
regions: [1, 2],
customer_info: {
ext_client_id: '123456',
ext_billing_id: '654321',
service_types: ['Tolls', 'Violations'],
email: 'email@example.com',
notes: 'Detailed notes here'
}
})
};
fetch('https://api.app.fleetit.com/v2/fleets/', 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.app.fleetit.com/v2/fleets/",
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([
'title' => 'Fleet XYZ',
'is_active' => true,
'regions' => [
1,
2
],
'customer_info' => [
'ext_client_id' => '123456',
'ext_billing_id' => '654321',
'service_types' => [
'Tolls',
'Violations'
],
'email' => 'email@example.com',
'notes' => 'Detailed notes here'
]
]),
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.app.fleetit.com/v2/fleets/"
payload := strings.NewReader("{\n \"title\": \"Fleet XYZ\",\n \"is_active\": true,\n \"regions\": [\n 1,\n 2\n ],\n \"customer_info\": {\n \"ext_client_id\": \"123456\",\n \"ext_billing_id\": \"654321\",\n \"service_types\": [\n \"Tolls\",\n \"Violations\"\n ],\n \"email\": \"email@example.com\",\n \"notes\": \"Detailed notes here\"\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.app.fleetit.com/v2/fleets/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Fleet XYZ\",\n \"is_active\": true,\n \"regions\": [\n 1,\n 2\n ],\n \"customer_info\": {\n \"ext_client_id\": \"123456\",\n \"ext_billing_id\": \"654321\",\n \"service_types\": [\n \"Tolls\",\n \"Violations\"\n ],\n \"email\": \"email@example.com\",\n \"notes\": \"Detailed notes here\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.app.fleetit.com/v2/fleets/")
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 \"title\": \"Fleet XYZ\",\n \"is_active\": true,\n \"regions\": [\n 1,\n 2\n ],\n \"customer_info\": {\n \"ext_client_id\": \"123456\",\n \"ext_billing_id\": \"654321\",\n \"service_types\": [\n \"Tolls\",\n \"Violations\"\n ],\n \"email\": \"email@example.com\",\n \"notes\": \"Detailed notes here\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": 109,
"title": "Fleet XYZ",
"is_active": true,
"regions": [
"Region1",
"Region2"
],
"customer_info": {
"ext_client_id": "123456",
"ext_billing_id": "654321",
"service_types": [
"Tolls",
"Violations"
],
"email": "email@example.com",
"notes": "Detailed notes here"
}
}Fleet
Create
Create a fleet in the system.
POST
/
v2
/
fleets
/
Create
curl --request POST \
--url https://api.app.fleetit.com/v2/fleets/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "Fleet XYZ",
"is_active": true,
"regions": [
1,
2
],
"customer_info": {
"ext_client_id": "123456",
"ext_billing_id": "654321",
"service_types": [
"Tolls",
"Violations"
],
"email": "email@example.com",
"notes": "Detailed notes here"
}
}
'import requests
url = "https://api.app.fleetit.com/v2/fleets/"
payload = {
"title": "Fleet XYZ",
"is_active": True,
"regions": [1, 2],
"customer_info": {
"ext_client_id": "123456",
"ext_billing_id": "654321",
"service_types": ["Tolls", "Violations"],
"email": "email@example.com",
"notes": "Detailed notes here"
}
}
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({
title: 'Fleet XYZ',
is_active: true,
regions: [1, 2],
customer_info: {
ext_client_id: '123456',
ext_billing_id: '654321',
service_types: ['Tolls', 'Violations'],
email: 'email@example.com',
notes: 'Detailed notes here'
}
})
};
fetch('https://api.app.fleetit.com/v2/fleets/', 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.app.fleetit.com/v2/fleets/",
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([
'title' => 'Fleet XYZ',
'is_active' => true,
'regions' => [
1,
2
],
'customer_info' => [
'ext_client_id' => '123456',
'ext_billing_id' => '654321',
'service_types' => [
'Tolls',
'Violations'
],
'email' => 'email@example.com',
'notes' => 'Detailed notes here'
]
]),
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.app.fleetit.com/v2/fleets/"
payload := strings.NewReader("{\n \"title\": \"Fleet XYZ\",\n \"is_active\": true,\n \"regions\": [\n 1,\n 2\n ],\n \"customer_info\": {\n \"ext_client_id\": \"123456\",\n \"ext_billing_id\": \"654321\",\n \"service_types\": [\n \"Tolls\",\n \"Violations\"\n ],\n \"email\": \"email@example.com\",\n \"notes\": \"Detailed notes here\"\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.app.fleetit.com/v2/fleets/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Fleet XYZ\",\n \"is_active\": true,\n \"regions\": [\n 1,\n 2\n ],\n \"customer_info\": {\n \"ext_client_id\": \"123456\",\n \"ext_billing_id\": \"654321\",\n \"service_types\": [\n \"Tolls\",\n \"Violations\"\n ],\n \"email\": \"email@example.com\",\n \"notes\": \"Detailed notes here\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.app.fleetit.com/v2/fleets/")
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 \"title\": \"Fleet XYZ\",\n \"is_active\": true,\n \"regions\": [\n 1,\n 2\n ],\n \"customer_info\": {\n \"ext_client_id\": \"123456\",\n \"ext_billing_id\": \"654321\",\n \"service_types\": [\n \"Tolls\",\n \"Violations\"\n ],\n \"email\": \"email@example.com\",\n \"notes\": \"Detailed notes here\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": 109,
"title": "Fleet XYZ",
"is_active": true,
"regions": [
"Region1",
"Region2"
],
"customer_info": {
"ext_client_id": "123456",
"ext_billing_id": "654321",
"service_types": [
"Tolls",
"Violations"
],
"email": "email@example.com",
"notes": "Detailed notes here"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Was this page helpful?
⌘I

