Bookmark or Unbookmark a Spot
This guide explains how to bookmark or unbookmark a specific spot 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/spots/{id}/toggleBookmark" \
-H "AARA_API_KEY: YOUR_API_KEY" \
-H "UNIQUE_USER_ID: UNIQUE_USER_ID"
JavaScript example
const toggleSpotBookmark = async (spotId) => {
const response = await fetch(
`https://api.aara.app/v1/spots/${spotId}/toggleBookmark`,
{
method: "POST",
headers: {
AARA_API_KEY: "YOUR_API_KEY",
UNIQUE_USER_ID: "UNIQUE_USER_ID",
},
}
);
const data = await response.json();
console.log(data);
};
toggleSpotBookmark("your-spot-id");
Instructions:
- Replace
YOUR_API_KEYandUNIQUE_USER_IDwith your actual credentials. - Replace
your-spot-idwith the unique ID of the spot you want to bookmark or unbookmark. - The API call will toggle the bookmark status of the specified spot and return the updated spot details.
Toggle Bookmark Parameters
When bookmarking or unbookmarking a spot, the only required parameter is the spot's unique identifier (id). Below is a breakdown of the required parameter:
| Parameter Name | Data Type | Usage | Possible Values | Optional |
|---|---|---|---|---|
id | string | Required. The unique identifier of the spot to toggle. | Any valid spot ID string. | No |
Response
The response from the API will be a JSON object containing the updated details of the spot, including its new bookmark status.
Example Response
{
id: "abcdefghijklmn1234567890",
name: "The Crying Tiger",
shortDescription: "A local’s favourite, the Crying Tiger offers delicious Thai food in a warm and lovely bistro setting.",
description: "We absolutely recommend the red curry and ideally, have it spicy, and the good old pad thai is fantastic too. The bar and the terrasse are lovely to enjoy both in summer and winter. Highly recommended!",
phone: "+33 1 40 47 07 54",
fullAddress: "72 Rue du Cherche-Midi, 75006 Paris, France",
lat: 48.8483422,
lng: 2.3239264,
isActive: true,
isBookmarked: true,
category: {
id: "abcdefghijklmn1234567890",
name: "Food"
},
medias: [
{
id: "abcdefghijklmn1234567890",
url: "https://example.com/image1.jpg"
},
{
id: "abcdefghijklmn1234567890",
url: "https://example.com/image2.jpg"
}
],
openingHours: {
monday: {
open: "10:00",
close: "22:00"
},
tuesday: {
open: "10:00",
close: "22:00"
},
wednesday: {
open: "10:00",
close: "22:00"
},
thursday: {
open: "10:00",
close: "22:00"
},
friday: {
open: "10:00",
close: "23:00"
},
saturday: {
open: "10:00",
close: "23:00"
},
sunday: {
open: "10:00",
close: "22:00"
}
}
}
This response shows the updated details of the spot, including whether it is bookmarked.