Bookmark or Unbookmark a Journey
This guide explains how to bookmark or unbookmark 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 POST "https://api.aara.app/v1/journeys/{id}/toggleBookmark" \
-H "AARA_API_KEY: YOUR_API_KEY" \
-H "UNIQUE_USER_ID: UNIQUE_USER_ID"
JavaScript example
const toggleJourneyBookmark = async (journeyId) => {
const response = await fetch(
`https://api.aara.app/v1/journeys/${journeyId}/toggleBookmark`,
{
method: "POST",
headers: {
AARA_API_KEY: "YOUR_API_KEY",
UNIQUE_USER_ID: "UNIQUE_USER_ID",
},
}
);
const data = await response.json();
console.log(data);
};
toggleJourneyBookmark("your-journey-id");
Instructions:
- Replace
YOUR_API_KEYandUNIQUE_USER_IDwith your actual credentials. - Replace
your-journey-idwith the unique ID of the journey you want to bookmark or unbookmark. - The API call will toggle the bookmark status of the specified journey and return the updated journey details.
Toggle Bookmark Parameters
When bookmarking or unbookmarking a journey, the only required parameter is the journey's unique identifier (id). Below is a breakdown of the required parameter:
| Parameter Name | Data Type | Usage | Possible Values |
|---|---|---|---|
id | string | Required. The unique identifier of the journey to toggle. | Any valid journey ID string. |
Response
The response from the API will be a JSON object containing the updated details of the journey, including its new bookmark status.
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 the updated details of the journey, including whether it is bookmarked.