Skip to main content

Tourist Profile Interests API

The Tourist Profile Interests API manages the many-to-many relationship between tourist profiles and interest categories. This allows tourists to select multiple interests for their profile to improve tour matching and recommendations.

Base Endpoint

/api/tourist_profile_interests

Tourist Profile Interest Model

This is a join table with a composite primary key.
userId
integer
required
User ID of the tourist profile
interestId
integer
required
Interest category ID

Add Interest to Tourist Profile

Associate an interest category with a tourist profile.
POST /api/tourist_profile_interests

Request Body

userId
integer
required
User ID of the tourist
interestId
integer
required
Interest category ID to add

Example Request

curl -X POST "http://localhost:8080/api/tourist_profile_interests" \
  -H "Content-Type: application/json" \
  -d '{
    "userId": 5,
    "interestId": 1
  }'

Example Response

{
  "userId": 5,
  "interestId": 1
}

Get All Tourist Profile Interests

Retrieve all tourist-interest associations.
GET /api/tourist_profile_interests

Example Request

curl -X GET "http://localhost:8080/api/tourist_profile_interests"

Example Response

[
  {
    "userId": 5,
    "interestId": 1
  },
  {
    "userId": 5,
    "interestId": 3
  },
  {
    "userId": 7,
    "interestId": 2
  }
]

Get Specific Tourist Profile Interest

Retrieve a specific tourist-interest association using the composite key.
GET /api/tourist_profile_interests/{userId}/{interestId}

Path Parameters

userId
integer
required
Tourist user ID
interestId
integer
required
Interest category ID

Example Request

curl -X GET "http://localhost:8080/api/tourist_profile_interests/5/1"

Example Response

{
  "userId": 5,
  "interestId": 1
}

Update Tourist Profile Interest

Update a tourist-interest association (rarely used since it’s a simple join).
PUT /api/tourist_profile_interests/{userId}/{interestId}

Path Parameters

userId
integer
required
Tourist user ID
interestId
integer
required
Interest category ID

Request Body

userId
integer
required
User ID (must match path parameter)
interestId
integer
required
Interest ID (must match path parameter)

Remove Interest from Tourist Profile

Remove an interest association from a tourist profile.
DELETE /api/tourist_profile_interests/{userId}/{interestId}

Path Parameters

userId
integer
required
Tourist user ID
interestId
integer
required
Interest category ID

Example Request

curl -X DELETE "http://localhost:8080/api/tourist_profile_interests/5/1"

Example Response

204 No Content

Usage Examples

Get All Interests for a Tourist

To get all interests for a specific tourist, filter the results by userId:
# Get all associations
curl -X GET "http://localhost:8080/api/tourist_profile_interests" \
  | jq '.[] | select(.userId == 5)'

Add Multiple Interests

To add multiple interests to a tourist profile, make multiple POST requests:
# Add Adventure
curl -X POST "http://localhost:8080/api/tourist_profile_interests" \
  -H "Content-Type: application/json" \
  -d '{"userId": 5, "interestId": 1}'

# Add Culture
curl -X POST "http://localhost:8080/api/tourist_profile_interests" \
  -H "Content-Type: application/json" \
  -d '{"userId": 5, "interestId": 2}'

# Add Gastronomy
curl -X POST "http://localhost:8080/api/tourist_profile_interests" \
  -H "Content-Type: application/json" \
  -d '{"userId": 5, "interestId": 3}'

Tourist Profiles

Manage tourist profiles

Interests

Browse available interest categories

Build docs developers (and LLMs) love