Get a Journey by ID

This guide explains how to retrieve a journey using the Aara API by its unique identifier (id). We'll start with an example using curl and follow it up with JavaScript examples utilizing the native fetch API.

Curl example

curl -X GET "https://api.aara.app/v1/journeys/{id}" \
-H "AARA_API_KEY: YOUR_API_KEY" \
-H "UNIQUE_USER_ID: UNIQUE_USER_ID"

JavaScript example

const getJourneyById = async (journeyId) => {
  const response = await fetch(
    `https://api.aara.app/v1/journeys/${journeyId}`,
    {
      method: "GET",
      headers: {
        AARA_API_KEY: "YOUR_API_KEY",
        UNIQUE_USER_ID: "UNIQUE_USER_ID",
      },
    }
  );

  const data = await response.json();
  console.log(data);
};

getJourneyById("your-journey-id");

Instructions:

  • Replace YOUR_API_KEY and UNIQUE_USER_ID with your actual credentials.
  • Replace your-journey-id with the unique ID of the journey you want to retrieve.
  • The API call returns a JSON object containing the details of the specified journey.

Get Journey by ID Parameters

When retrieving a journey by ID, the only required parameter is the journey's unique identifier (id). Below is a breakdown of the required and optional parameters:

Parameter NameData TypeUsagePossible Values
idstringRequired. The unique identifier of the journey to retrieve.Any valid journey ID string.

Response

The response from the API will be a JSON object containing the details of the journey, including information such as the journey's name, distance, duration, city, spots included, and other relevant data.


Example Response

{
  id: "abcdefghijklmn1234567890",
  name: "Paris Food Tour",
  createdAt: "2024-08-08T13:45:55.045Z",
  isBookmarked: true,
  distance: 1559,
  duration: 1279,
  city: {
    id: "abcdefghijklmn1234567890",
    name: "Paris"
  },
  spots: [
    {
      id: "abcdefghijklmn1234567890",
      name: "The Crying Tiger",
      lat: 48.8483422,
      lng: 2.3239264,
      shortDescription: "A local’s favourite...",
      phone: "+33 1 40 47 07 54",
      fullAddress: "72 Rue du Cherche-Midi, 75006 Paris, France",
      isBookmarked: false,
      category: {
        id: "abcdefghijklmn1234567890",
        name: "Food"
      },
      medias: [
        {
          id: "abcdefghijklmn1234567890",
          url: "https://example.com/image1.jpg"
        }
      ]
    }
  ],
  directionData: [
    {
      latitude: 48.84233,
      longitude: 2.32816
    }
  ]
}

This response shows a detailed structure of a journey, including spots and direction data associated with it.