API Reference - Tag Types

Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108061

← Back to API Reference | Getting Started

Tag Types

Tag Types define the kinds of objects that tags can be applied to. Each tag type specifies a name and the database table it relates to, enabling the tag relationship system to link tags to members, posts, or any other object type on your directory.

Model name in URL: tag_types — DB table: tag_types

The Tag Type Object

FieldTypeDescription
idintegerUnique tag type ID (primary key, read-only)
type_namestringThe name of the tag type (EG Users, Posts)
table_relationstringThe database table this type is associated with (EG users_data)

List Tag Type Records

GET /api/v2/tag_types/get

Returns a paginated list of tag type records.

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/tag_types/get?limit=25" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "id": "1",
      "type_name": "Users",
      "table_relation": "users_data"
    }
  ],
  "total": "1",
  "current_page": 1,
  "total_pages": 1
}

Retrieve a Tag Type Record

GET /api/v2/tag_types/get/{id}

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/tag_types/get/1" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "id": "1",
      "type_name": "Users",
      "table_relation": "users_data"
    }
  ],
  "total": "1",
  "current_page": 1,
  "total_pages": 1
}

Create a Tag Type Record

POST /api/v2/tag_types/create

Example Request

Copy
curl -X POST "https://www.yourdomain.com/api/v2/tag_types/create" \
  -H "X-Api-Key: your-api-key-here" \
  -d "type_name=Posts" \
  -d "table_relation=data_posts"

Example Response

Copy
{
  "status": "success",
  "message": {
    "id": "2",
    "type_name": "Posts",
    "table_relation": "data_posts"
  }
}

Update a Tag Type Record

PUT /api/v2/tag_types/update

Example Request

Copy
curl -X PUT "https://www.yourdomain.com/api/v2/tag_types/update" \
  -H "X-Api-Key: your-api-key-here" \
  -d "id=2" \
  -d "type_name=Member+Posts"

Example Response

Copy
{
  "status": "success",
  "message": {
    "id": "2",
    "type_name": "Member Posts",
    "table_relation": "data_posts"
  }
}

Delete a Tag Type Record

DELETE /api/v2/tag_types/delete

Example Request

Copy
curl -X DELETE "https://www.yourdomain.com/api/v2/tag_types/delete" \
  -H "X-Api-Key: your-api-key-here" \
  -d "id=2"

Example Response

Copy
{
  "status": "success",
  "message": "tag_types record was deleted"
}