1. Home
  2. Docs
  3. Eventer
  4. REST API
  5. Creating Taxonomies

Creating Taxonomies

Endpoint

POST https://example.com/wp-json/eventer/v1/create-taxonomy

Headers

Authorization: Basic base64_encode(username:application_password)
Content-Type: application/json

Request Body Parameters

Parameter Type Required Description
taxonomy String Yes The taxonomy to which the term belongs. Supported values: eventer-category, eventer-tag, eventer-venue, eventer-organizer.
name String Yes The name of the taxonomy term (e.g., “Music”).
slug String No A unique slug for the term (e.g., “music-events”). If not provided, it will be auto-generated from the name.
description String No A description for the taxonomy term.

Example Requests

Create an Eventer Category
curl -X POST https://example.com/wp-json/eventer/v1/create-taxonomy \
-H "Authorization: Basic dXNlcm5hbWU6YXBwbGljYXRpb25fcGFzc3dvcmQ=" \
-H "Content-Type: application/json" \
-d '{
  "taxonomy": "eventer-category",
  "name": "Music",
  "slug": "music-events",
  "description": "Events related to live music and performances."
}'

Create an Eventer Tag

curl -X POST https://example.com/wp-json/eventer/v1/create-taxonomy \
-H "Authorization: Basic dXNlcm5hbWU6YXBwbGljYXRpb25fcGFzc3dvcmQ=" \
-H "Content-Type: application/json" \
-d '{
  "taxonomy": "eventer-tag",
  "name": "Outdoor",
  "description": "Events held outdoors."
}'

Example Responses

Success Response
{
  "success": true,
  "message": "Taxonomy term created successfully.",
  "term_id": 456,
  "taxonomy": "eventer-category"
}

Error Response (Invalid Taxonomy)

{
  "success": false,
  "message": "Invalid taxonomy. Supported taxonomies are: eventer-category, eventer-tag, eventer-venue, eventer-organizer"
}

Error Response (Duplicate Term)

{
  "success": false,
  "message": "A term with the name provided already exists."
}

Notes

  1. Supported Taxonomies:
    • eventer-category: Categories for events.
    • eventer-tag: Tags for events.
    • eventer-venue: Venue locations for events.
    • eventer-organizer: Organizers for events.
  2. Slug Auto-Generation:
    • If the slug is not provided, WordPress will automatically generate one based on the name.
  3. Permission Requirements:
    • The user must have the manage_categories capability to create taxonomy terms. Typically, administrators have this capability.
  4. Error Handling:
    • Duplicate terms or invalid inputs will return appropriate error messages.
  5. Integration with Eventer API:
    • Once a taxonomy term is created, it can be assigned to events using the eventer-category, eventer-tag, eventer-venue, or eventer-organizer fields in the create event API.

How can we help?