API Reference - Tag Relationships
Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108062
← Back to API Reference | Getting Started
Tag Relationships
Tag Relationships link individual tags to specific objects (such as members) on your directory. Each record associates a tag with an object ID and specifies the tag type, enabling flexible many-to-many tag assignments across different object types.
rel_tags — DB table: rel_tagsThe Tag Relationship Object
| Field | Type | Description |
|---|---|---|
id | integer | Unique tag relationship ID (primary key, read-only) |
tag_id | string | ID of the tag being applied (foreign key to tags) |
object_id | integer | ID of the object the tag is applied to (foreign key referencing the table in tag_types.table_relation) |
tag_type_id | integer | ID of the tag type that defines what kind of object is being tagged (foreign key to tag_types) |
added_by | integer | User ID of the user who created this tag relationship |
created_at | datetime | Timestamp when this tag relationship was created |
List Tag Relationship Records
Returns a paginated list of tag relationship records.
Example Request
curl -X GET "https://www.yourdomain.com/api/v2/rel_tags/get?limit=25" \ -H "X-Api-Key: your-api-key-here"
Example Response
{
"status": "success",
"message": [
{
"id": "2",
"tag_id": "1",
"object_id": "1096",
"tag_type_id": "1",
"added_by": "27",
"created_at": "2024-06-04 16:36:35"
},
{
"id": "3",
"tag_id": "1",
"object_id": "1095",
"tag_type_id": "1",
"added_by": "27",
"created_at": "2024-06-04 16:36:35"
}
],
"total": "1476",
"current_page": 1,
"total_pages": 492,
"next_page": "MipfKjM="
}Retrieve a Tag Relationship Record
Example Request
curl -X GET "https://www.yourdomain.com/api/v2/rel_tags/get/2" \ -H "X-Api-Key: your-api-key-here"
Example Response
{
"status": "success",
"message": [
{
"id": "2",
"tag_id": "1",
"object_id": "1096",
"tag_type_id": "1",
"added_by": "27",
"created_at": "2024-06-04 16:36:35"
}
],
"total": "1476",
"current_page": 1,
"total_pages": 60,
"next_page": "MipfKjI1"
}Create a Tag Relationship Record
Applies a tag to an object by creating a tag relationship record.
Example Request
curl -X POST "https://www.yourdomain.com/api/v2/rel_tags/create" \ -H "X-Api-Key: your-api-key-here" \ -d "tag_id=1" \ -d "object_id=500" \ -d "tag_type_id=1" \ -d "added_by=1"
Example Response
{
"status": "success",
"message": {
"id": "1479",
"tag_id": "1",
"object_id": "500",
"tag_type_id": "1",
"added_by": "1",
"created_at": null
}
}Update a Tag Relationship Record
Example Request
curl -X PUT "https://www.yourdomain.com/api/v2/rel_tags/update" \ -H "X-Api-Key: your-api-key-here" \ -d "id=1479" \ -d "object_id=501"
Example Response
{
"status": "success",
"message": {
"id": "1479",
"tag_id": "1",
"object_id": "501",
"tag_type_id": "1",
"added_by": "1",
"created_at": "0000-00-00 00:00:00"
}
}Delete a Tag Relationship Record
Example Request
curl -X DELETE "https://www.yourdomain.com/api/v2/rel_tags/delete" \ -H "X-Api-Key: your-api-key-here" \ -d "id=1479"
Example Response
{
"status": "success",
"message": "rel_tags record was deleted"
}