API Reference - User Favorites
Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108066
← Back to API Reference | Getting Started
User Favorites
User Favorites tracks which posts, listings, or features a member has saved or interacted with. Each record associates a user with a specific post across different content types and feature areas on the directory.
Model name in URL:
users_favorite — DB table: users_favoriteThe User Favorites Object
| Field | Type | Description |
|---|---|---|
id | integer | Unique favorite record ID (primary key, read-only) |
userId | integer | ID of the user who saved the favorite (foreign key to users) |
ownerId | integer | ID of the member who owns the favorited content (default 0) |
postId | integer | ID of the post or listing that was favorited |
dataType | integer | Numeric identifier for the type of content that was favorited (maps to a data category) |
featureId | integer | ID of the feature or widget context where the favorite was created |
checked | integer | Whether the favorite is currently active/checked (0 = unchecked, 1 = checked; default 0) |
List User Favorite Records
GET /api/v2/users_favorite/get
Returns a paginated list of user favorite records.
Example Request
Copy
curl -X GET "https://www.yourdomain.com/api/v2/users_favorite/get?limit=25" \ -H "X-Api-Key: your-api-key-here"
Example Response
Copy
{
"status": "success",
"message": [
{
"tablesExists": true,
"id": "910031",
"userId": "1",
"ownerId": "35",
"postId": "87",
"dataType": "20",
"featureId": "8",
"checked": "0"
},
{
"tablesExists": true,
"id": "910035",
"userId": "1",
"ownerId": "35",
"postId": "0",
"dataType": "10",
"featureId": "1",
"checked": "0"
}
],
"total": "2",
"current_page": 1,
"total_pages": 1
}Retrieve a User Favorite Record
GET /api/v2/users_favorite/get/{id}
Example Request
Copy
curl -X GET "https://www.yourdomain.com/api/v2/users_favorite/get/910031" \ -H "X-Api-Key: your-api-key-here"
Example Response
Copy
{
"status": "success",
"message": [
{
"tablesExists": true,
"id": "910031",
"userId": "1",
"ownerId": "35",
"postId": "87",
"dataType": "20",
"featureId": "8",
"checked": "0"
}
],
"total": "2",
"current_page": 1,
"total_pages": 1
}Create a User Favorite Record
POST /api/v2/users_favorite/create
Example Request
Copy
curl -X POST "https://www.yourdomain.com/api/v2/users_favorite/create" \ -H "X-Api-Key: your-api-key-here" \ -d "userId=1" \ -d "postId=87" \ -d "dataType=20" \ -d "featureId=8"
Example Response
Copy
{
"status": "success",
"message": {
"id": "910037",
"userId": "1",
"ownerId": null,
"postId": "87",
"dataType": "20",
"featureId": "8",
"checked": null
}
}Update a User Favorite Record
PUT /api/v2/users_favorite/update
Example Request
Copy
curl -X PUT "https://www.yourdomain.com/api/v2/users_favorite/update" \ -H "X-Api-Key: your-api-key-here" \ -d "id=910031" \ -d "checked=1"
Example Response
Copy
{
"status": "success",
"message": {
"id": "910031",
"userId": "1",
"ownerId": "35",
"postId": "87",
"dataType": "20",
"featureId": "8",
"checked": "1"
}
}Delete a User Favorite Record
DELETE /api/v2/users_favorite/delete
Example Request
Copy
curl -X DELETE "https://www.yourdomain.com/api/v2/users_favorite/delete" \ -H "X-Api-Key: your-api-key-here" \ -d "id=910031"
Example Response
Copy
{
"status": "success",
"message": "users_favorite record was deleted"
}