Overview
The Favorite Guides API allows tourists to save their favorite guides for easy access and follow-up. This resource uses a composite key consisting oftouristId and guideId to uniquely identify favorite relationships.
Composite Key Structure
Favorite guide records are identified by a composite primary key:- touristId: The ID of the tourist user
- guideId: The ID of the guide user
Endpoints
Create Favorite Guide
The ID of the tourist user marking the guide as favorite
The ID of the guide user being marked as favorite
Optional timestamp. If not provided, the server will set it automatically.
The ID of the tourist user
The ID of the guide user
Timestamp when the favorite was created
Get All Favorite Guides
Array of favorite guide objects
Get Favorite Guide by Composite Key
The ID of the tourist user
The ID of the guide user
The ID of the tourist user
The ID of the guide user
Timestamp when the favorite was created
Update Favorite Guide
The ID of the tourist user
The ID of the guide user
Updated timestamp for when the favorite was created
The ID of the tourist user
The ID of the guide user
Updated timestamp
Delete Favorite Guide
The ID of the tourist user
The ID of the guide user
No content returned on successful deletion
Usage Examples
Check if Guide is Favorited
To check if a specific guide is in a tourist’s favorites:- If the relationship exists, you’ll receive a 200 response with the favorite data
- If it doesn’t exist, you’ll receive a 404 error
Get Tourist’s Favorite Guides
To retrieve all guides favorited by a specific tourist, filter the results from the get all endpoint:Get Guides Who Favorited a User
To see which tourists have favorited a specific guide:Relationships
The FavoriteGuide entity maintains relationships with:- Tourist User: References the user table via
touristId→user_id - Guide User: References the user table via
guideId→user_id