curl --request PUT \
--url https://api.exowpee.com/v1/catalog/trips/{trip}/legs/{leg} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from_stop_id": "<string>",
"from_stop_position": 2,
"to_stop_id": "<string>",
"to_stop_position": 2,
"distance_km": "<string>",
"rates": "<string>"
}
'import requests
url = "https://api.exowpee.com/v1/catalog/trips/{trip}/legs/{leg}"
payload = {
"from_stop_id": "<string>",
"from_stop_position": 2,
"to_stop_id": "<string>",
"to_stop_position": 2,
"distance_km": "<string>",
"rates": "<string>"
}
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({
from_stop_id: '<string>',
from_stop_position: 2,
to_stop_id: '<string>',
to_stop_position: 2,
distance_km: '<string>',
rates: '<string>'
})
};
fetch('https://api.exowpee.com/v1/catalog/trips/{trip}/legs/{leg}', 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.exowpee.com/v1/catalog/trips/{trip}/legs/{leg}",
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([
'from_stop_id' => '<string>',
'from_stop_position' => 2,
'to_stop_id' => '<string>',
'to_stop_position' => 2,
'distance_km' => '<string>',
'rates' => '<string>'
]),
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.exowpee.com/v1/catalog/trips/{trip}/legs/{leg}"
payload := strings.NewReader("{\n \"from_stop_id\": \"<string>\",\n \"from_stop_position\": 2,\n \"to_stop_id\": \"<string>\",\n \"to_stop_position\": 2,\n \"distance_km\": \"<string>\",\n \"rates\": \"<string>\"\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://api.exowpee.com/v1/catalog/trips/{trip}/legs/{leg}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from_stop_id\": \"<string>\",\n \"from_stop_position\": 2,\n \"to_stop_id\": \"<string>\",\n \"to_stop_position\": 2,\n \"distance_km\": \"<string>\",\n \"rates\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/trips/{trip}/legs/{leg}")
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 \"from_stop_id\": \"<string>\",\n \"from_stop_position\": 2,\n \"to_stop_id\": \"<string>\",\n \"to_stop_position\": 2,\n \"distance_km\": \"<string>\",\n \"rates\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"trip_id": "<string>",
"from_stop_id": "<string>",
"to_stop_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"rates": [
{
"id": "<string>",
"trip_id": "<string>",
"trip_leg_id": "<string>",
"label": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}{
"message": "<string>",
"errors": {}
}Change a trip leg
Re-points a leg of a trip to different start or end stops.
curl --request PUT \
--url https://api.exowpee.com/v1/catalog/trips/{trip}/legs/{leg} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from_stop_id": "<string>",
"from_stop_position": 2,
"to_stop_id": "<string>",
"to_stop_position": 2,
"distance_km": "<string>",
"rates": "<string>"
}
'import requests
url = "https://api.exowpee.com/v1/catalog/trips/{trip}/legs/{leg}"
payload = {
"from_stop_id": "<string>",
"from_stop_position": 2,
"to_stop_id": "<string>",
"to_stop_position": 2,
"distance_km": "<string>",
"rates": "<string>"
}
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({
from_stop_id: '<string>',
from_stop_position: 2,
to_stop_id: '<string>',
to_stop_position: 2,
distance_km: '<string>',
rates: '<string>'
})
};
fetch('https://api.exowpee.com/v1/catalog/trips/{trip}/legs/{leg}', 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.exowpee.com/v1/catalog/trips/{trip}/legs/{leg}",
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([
'from_stop_id' => '<string>',
'from_stop_position' => 2,
'to_stop_id' => '<string>',
'to_stop_position' => 2,
'distance_km' => '<string>',
'rates' => '<string>'
]),
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.exowpee.com/v1/catalog/trips/{trip}/legs/{leg}"
payload := strings.NewReader("{\n \"from_stop_id\": \"<string>\",\n \"from_stop_position\": 2,\n \"to_stop_id\": \"<string>\",\n \"to_stop_position\": 2,\n \"distance_km\": \"<string>\",\n \"rates\": \"<string>\"\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://api.exowpee.com/v1/catalog/trips/{trip}/legs/{leg}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from_stop_id\": \"<string>\",\n \"from_stop_position\": 2,\n \"to_stop_id\": \"<string>\",\n \"to_stop_position\": 2,\n \"distance_km\": \"<string>\",\n \"rates\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/trips/{trip}/legs/{leg}")
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 \"from_stop_id\": \"<string>\",\n \"from_stop_position\": 2,\n \"to_stop_id\": \"<string>\",\n \"to_stop_position\": 2,\n \"distance_km\": \"<string>\",\n \"rates\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"trip_id": "<string>",
"from_stop_id": "<string>",
"to_stop_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"rates": [
{
"id": "<string>",
"trip_id": "<string>",
"trip_leg_id": "<string>",
"label": "<string>",
"amount": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}{
"message": "<string>",
"errors": {}
}trip_legs.update
Conditions
- Only the company that owns the trip can change it; a trip shared by another company can be read but not modified.
- Only a trip whose status is active can be modified; an archived trip is refused with a validation error.
- Only the side that is sent changes; the destination must still come after the source and the pair must not already be used by another leg (409).
- distance_km and rates are refused.
- Only the start and end stops can change.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Identifier of the trip (27-character KSUID). The trip must be visible to the calling company.
Identifier of the trip leg; it must belong to the trip in the URL.
Body
Identifier of the stop where the leg starts. Alternative to from_stop_position; the id wins when both are sent. Must be a stop of this trip.
27Position of the stop where the leg starts, used when from_stop_id is not sent. Minimum 1.
x >= 1Identifier of the stop where the leg ends; it must come after the source on the route. Alternative to to_stop_position; the id wins when both are sent.
27Position of the stop where the leg ends, used when to_stop_id is not sent. Minimum 1.
x >= 1Not accepted: legs carry no distance; any value is refused.
Not accepted on this endpoint: add rates to a leg through the rates endpoint with trip_leg_id.
Response
TripLegResource
Identifier of the leg (27-character KSUID).
Identifier of the trip the leg belongs to.
Identifier of the stop where the leg starts.
Identifier of the stop where the leg ends.
Date and time the record was created (ISO 8601, UTC).
Date and time the record was last changed (ISO 8601, UTC).
Rates of this leg owned by the calling company; present only when the relation is loaded (trip responses, not leg create or update).
Show child attributes
Show child attributes