API Reference - Categories (Professions)

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

← Back to API Reference | Getting Started

Categories (Professions)

Categories (also called Professions) are the primary classification system for members and content on your directory. Each category can be associated with a category group and used to organize member listings, search results, and browse pages.

Model name in URL: category — DB table: category

The Category Object

FieldTypeDescription
category_idintegerUnique category ID (primary key, read-only)
namestringDisplay name of the category
group_idintegerID of the category group this category belongs to
filenamestringURL-friendly slug for the category page
iconstringIcon class or image reference for this category
keywordstextSEO keywords associated with this category
revision_timestamptimestampLast modified timestamp (auto-updated)
json_metatextAdditional metadata stored as JSON

List Category Records

GET /api/v2/category/get

Returns a paginated list of category records.

Example Request

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

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "category_id": "1",
      "name": "Plumbers",
      "group_id": "1",
      "filename": "plumbers",
      "icon": "",
      "keywords": "plumber, plumbing, pipe repair",
      "revision_timestamp": "2024-01-15 09:30:00",
      "json_meta": ""
    }
  ],
  "total": "1",
  "current_page": 1,
  "total_pages": 1
}

Retrieve a Category Record

GET /api/v2/category/get/{category_id}

Example Request

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

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "category_id": "1",
      "name": "Plumbers",
      "group_id": "1",
      "filename": "plumbers",
      "icon": "",
      "keywords": "plumber, plumbing, pipe repair",
      "revision_timestamp": "2024-01-15 09:30:00",
      "json_meta": ""
    }
  ],
  "total": "1",
  "current_page": 1,
  "total_pages": 1
}

Create a Category Record

POST /api/v2/category/create

Example Request

Copy
curl -X POST "https://www.yourdomain.com/api/v2/category/create" \
  -H "X-Api-Key: your-api-key-here" \
  -d "name=Electricians" \
  -d "filename=electricians" \
  -d "group_id=1" \
  -d "keywords=electrician,electrical,wiring"

Example Response

Copy
{
  "status": "success",
  "message": {
    "category_id": "2",
    "name": "Electricians",
    "group_id": "1",
    "filename": "electricians",
    "icon": null,
    "keywords": "electrician,electrical,wiring",
    "revision_timestamp": null,
    "json_meta": null
  }
}

Update a Category Record

PUT /api/v2/category/update

Example Request

Copy
curl -X PUT "https://www.yourdomain.com/api/v2/category/update" \
  -H "X-Api-Key: your-api-key-here" \
  -d "category_id=2" \
  -d "name=Licensed+Electricians" \
  -d "keywords=licensed+electrician,electrical,wiring"

Example Response

Copy
{
  "status": "success",
  "message": {
    "category_id": "2",
    "name": "Licensed Electricians",
    "group_id": "1",
    "filename": "electricians",
    "icon": "",
    "keywords": "licensed electrician,electrical,wiring",
    "revision_timestamp": "0000-00-00 00:00:00",
    "json_meta": ""
  }
}

Delete a Category Record

DELETE /api/v2/category/delete

Example Request

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

Example Response

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