Skip to content

Road Segment

The road segment resource.

Base/roadSegment
GET/roadSegment

List road segments

Retrieve a paginated list of road segments. Filter, order, and select columns with PostgREST query parameters.

Query parameters

selectstring

Comma-separated columns to return. Defaults to all.

orderstring

Column to sort by, e.g. `createdAt.desc`.

limitinteger

Maximum rows to return.

offsetinteger

Rows to skip, for pagination.

GET/roadSegment
curl --request GET \
  --url '<your-host>/roadSegment?select=*&limit=10' \
  --header 'Authorization: Bearer <api-key>'
Response
[
  {
    "id": "abc123def456",
    "companyId": "xyz789",
    "readableId": "xyz789",
    "fromNode": "string",
    "toNode": "string",
    "name": "Example",
    "distanceMiles": 0,
    "driveSeconds": 0
  }
]
GET/roadSegment

Retrieve a road segment

Fetch a single road segment by filtering on `id`.

Query parameters

idstring

Match on the road segment's `id`, e.g. `eq.{id}`.

GET/roadSegment
curl --request GET \
  --url '<your-host>/roadSegment?id=eq.%7Bid%7D' \
  --header 'Authorization: Bearer <api-key>'
Response
{
  "id": "abc123def456",
  "companyId": "xyz789",
  "readableId": "xyz789",
  "fromNode": "string",
  "toNode": "string",
  "name": "Example",
  "distanceMiles": 0,
  "driveSeconds": 0
}
POST/roadSegment

Create a road segment

Create a new road segment.

Body parameters

readableIdstringrequired
fromNodestringrequired
toNodestringrequired
namestring
distanceMilesnumberrequired
driveSecondsnumberrequired
hazmatAllowedbooleanrequired
geometryobject
POST/roadSegment
curl --request POST \
  --url <your-host>/roadSegment \
  --header 'Authorization: Bearer <api-key>' \
  --header 'Content-Type: application/json' \
  --header 'Prefer: return=representation' \
  --data '{"readableId":"xyz789","fromNode":"string","toNode":"string","name":"Example","distanceMiles":0,"driveSeconds":0,"hazmatAllowed":true}'
Response
{
  "id": "abc123def456",
  "companyId": "xyz789",
  "readableId": "xyz789",
  "fromNode": "string",
  "toNode": "string",
  "name": "Example",
  "distanceMiles": 0,
  "driveSeconds": 0
}
PATCH/roadSegment

Update a road segment

Update an existing road segment, matched on `id`.

Body parameters

readableIdstringrequired
fromNodestringrequired
toNodestringrequired
namestring
distanceMilesnumberrequired
driveSecondsnumberrequired
hazmatAllowedbooleanrequired
geometryobject
PATCH/roadSegment
curl --request PATCH \
  --url '<your-host>/roadSegment?id=eq.%7Bid%7D' \
  --header 'Authorization: Bearer <api-key>' \
  --header 'Content-Type: application/json' \
  --header 'Prefer: return=representation' \
  --data '{"readableId":"xyz789"}'
Response
{
  "id": "abc123def456",
  "companyId": "xyz789",
  "readableId": "xyz789",
  "fromNode": "string",
  "toNode": "string",
  "name": "Example",
  "distanceMiles": 0,
  "driveSeconds": 0
}
DELETE/roadSegment

Delete a road segment

Delete a road segment, matched on `id`. Returns 204 No Content.

Query parameters

idstring

The `id` of the road segment to delete, e.g. `eq.{id}`.

DELETE/roadSegment
curl --request DELETE \
  --url '<your-host>/roadSegment?id=eq.%7Bid%7D' \
  --header 'Authorization: Bearer <api-key>'
204 No Content