Skip to main content

First Steps

Use your access token to find a vehicle, check its connection, and read its current location.

Prerequisites

Obtain an access token as shown in Authentication.

Choose a vehicle

Request the vehicles available to your integration with GET https://api.polymathrobotics.dev/v1/vehicles.

The response contains an array of vehicles in data. For this guide, select the first vehicle and keep its id for later requests.

Requires curl and jq.

POLYMATH_VEHICLE_ID="$(
curl --silent --show-error --fail-with-body \
--url https://api.polymathrobotics.dev/v1/vehicles \
--header "Authorization: Bearer $POLYMATH_ACCESS_TOKEN" \
| jq -er '.data[0].id // error("No vehicles are available")'
)"
export POLYMATH_VEHICLE_ID

Check the connection

Use GET https://polyglot.polymathrobotics.dev/api/synapse/{vehicleId}/v2/health to confirm that the vehicle is reachable:

curl --silent --show-error --fail-with-body \
--url "https://polyglot.polymathrobotics.dev/api/synapse/$POLYMATH_VEHICLE_ID/v2/health" \
--header "Authorization: Bearer $POLYMATH_ACCESS_TOKEN"

Read vehicle location

The vehicle's current GPS location and bearing are available in the GET https://polyglot.polymathrobotics.dev/api/synapse/{vehicleId}/v2/polymath-feedback response at data.polymath_feedback.current_pose.pose.

curl --silent --show-error --fail-with-body \
--url "https://polyglot.polymathrobotics.dev/api/synapse/$POLYMATH_VEHICLE_ID/v2/polymath-feedback" \
--header "Authorization: Bearer $POLYMATH_ACCESS_TOKEN" \
| jq '.data.polymath_feedback.current_pose.pose'

The result has this form:

{
"position": {
"latitude": 40.634180274928184,
"longitude": -96.16258620804851,
"altitude": 0
},
"orientation": {
"x": 0,
"y": 0,
"z": 0.3013746455741215,
"w": 0.9535058064873398
}
}

Poll this endpoint when your application needs current vehicle state.

Next steps

Explore the API Reference for the full list of available endpoints.