Create a journey
This guide covers how to create a journey using the Aara API. We’ll start with a basic example using curl, followed by JavaScript examples using the native fetch API. The only required parameter to create a journey is cityName . All the rest is optional.
Curl example
curl -X POST "https://api.aara.app/v1/journeys" \
-H "AARA_API_KEY: YOUR_API_KEY" \
-H "UNIQUE_USER_ID: UNIQUE_USER_ID" \
-H "Content-Type: application/json" \
-d '{
"cityName": "Paris"
}'
JavaScript example (minimal Parameters)
const createJourney = async () => {
const response = await fetch("https://api.aara.app/v1/journeys", {
method: "POST",
headers: {
AARA_API_KEY: "YOUR_API_KEY",
UNIQUE_USER_ID: "UNIQUE_USER_ID",
"Content-Type": "application/json",
},
body: JSON.stringify({
cityName: "Paris",
}),
});
const data = await response.json();
console.log(data);
};
createJourney();
Instructions:
- Replace
YOUR_API_KEYandUNIQUE_USER_IDwith your actual credentials. - This script sends a POST request with the
cityNameset to "Paris".
JavaScript example (All Parameters)
const createJourney = async () => {
const response = await fetch("https://api.aara.app/v1/journeys", {
method: "POST",
headers: {
AARA_API_KEY: "YOUR_API_KEY",
UNIQUE_USER_ID: "UNIQUE_USER_ID",
"Content-Type": "application/json",
},
body: JSON.stringify({
cityName: "Paris",
categoryNames: ["Food", "Drinks"],
from: 8,
to: 23,
price: [0, 1, 2, 3],
lat: 48.856614,
lng: 2.3522219,
radius: 2,
}),
});
const data = await response.json();
console.log(data);
};
createJourney();
Instructions:
- Replace
YOUR_API_KEYandUNIQUE_USER_IDwith your actual credentials. - This script sends a POST request with the
cityNameset to "Paris".
Create Journey parameters
When creating a journey, you can customise it by providing several optional parameters along with the required cityName. Below is a table detailing each parameter:
| Parameter Name | Data Type | Usage | Possible Values |
|---|---|---|---|
cityName | string | Required. The name of the city where the journey is being created. | Any valid city name as a string (e.g., "Paris", "London"). |
categoryNames | array of strings | Optional. Specifies the categories of spots to include in the journey. | An array of strings. Example: ["Food", "Drinks"]. Categories should correspond to available spot types. |
from | number | Optional. Specifies the starting hour for the journey. | A number representing the hour in 24-hour format. Example: 8 (for 8:00 AM). |
to | number | Optional. Specifies the ending hour for the journey. | A number representing the hour in 24-hour format. Example: 23 (for 11:00 PM). |
price | array of numbers | Optional. Specifies the price range for spots to include in the journey. | An array of numbers. Example: [0, 1, 2, 3]. Typically represents pricing tiers, where 0 is cheap and 3 is high-end. |
lat | number | Optional. The latitude of the location to center the journey around. | A number representing latitude in decimal degrees. Example: 48.856614 (for Paris). |
lng | number | Optional. The longitude of the location to center the journey around. | A number representing longitude in decimal degrees. Example: 2.3522219 (for Paris). |
radius | number | Optional. The radius in kilometers around the specified location to search for spots. | A number representing the radius. Example: 2 (for 2 kilometers). |