List Journeys

This guide explains how to retrieve a list of journeys using the Aara API. We'll start with a basic example using curl and JavaScript examples utilizing the native fetch API, focusing only on the required parameters.

Curl example (Basic)

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

JavaScript example (Basic)

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

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

listJourneys();

Instructions:

  • Replace YOUR_API_KEY and UNIQUE_USER_ID with your actual credentials.
  • This basic API call will retrieve a list of journeys without any filters.

JavaScript example (Advanced)

const listJourneysWithOptions = async (options = {}) => {
  const { cityName, isBookmarked, page = 1, limit = 10 } = options;

  const response = await fetch("https://api.aara.app/v1/journeys", {
    method: "GET",
    headers: {
      AARA_API_KEY: "YOUR_API_KEY",
      UNIQUE_USER_ID: "UNIQUE_USER_ID",
    },
    body: JSON.stringify({
      cityName,
      isBookmarked,
      page,
      limit,
    }),
  });

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

// Example usage with options
listJourneysWithOptions({
  cityName: "Paris",
  isBookmarked: true,
  page: 2,
  limit: 5,
});

Instructions:

  • Replace YOUR_API_KEY and UNIQUE_USER_ID with your actual credentials.
  • This advanced API call allows you to specify additional parameters like cityName, isBookmarked, page, and limit.

List Journeys Parameters

When listing journeys, all parameters are optional, allowing you to filter the results as needed. Below is a breakdown of the available parameters and their optional status:

Parameter NameData TypeUsagePossible ValuesOptional
cityNamestringFilter journeys by the name of the city.Any valid city name as a string (e.g., "Paris").Yes
isBookmarkedbooleanFilter journeys that are bookmarked by the user.true or false.Yes
pagenumberThe page number for pagination (default is 1).Any positive integer (e.g., 1, 2).Yes
limitnumberThe number of journeys to return per page (default is 10).Any positive integer (e.g., 10, 20).Yes

Response

The response from the API will be a JSON object containing the list of journeys, along with pagination details such as the current page, total items, and limit per page.


Example Response

{
  limit: 10,
  page: 1,
  total: 25,
  journeys: [
    {
      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"
            }
          ]
        }
      ]
    },
    {
      id: "abcdefghijklmn1234567890",
      name: "Paris Museum Tour",
      createdAt: "2024-08-07T11:32:45.045Z",
      isBookmarked: false,
      distance: 1029,
      duration: 915,
      city: {
        id: "abcdefghijklmn1234567890",
        name: "Paris"
      },
      spots: [
        {
          id: "abcdefghijklmn1234567890",
          name: "Louvre Museum",
          lat: 48.8606111,
          lng: 2.337644,
          shortDescription: "World's largest art museum...",
          phone: "+33 1 40 20 50 50",
          fullAddress: "Rue de Rivoli, 75001 Paris, France",
          isBookmarked: false,
          category: {
            id: "abcdefghijklmn1234567890",
            name: "Museum"
          },
          medias: [
            {
              id: "abcdefghijklmn1234567890",
              url: "https://example.com/image2.jpg"
            }
          ]
        }
      ]
    }
  ]
}

This response shows a list of journeys with pagination details and the corresponding spots in each journey.