Get Specific Category

GET /categories/{correlationId} - Get Specific Category

Retrieve detailed information about a specific category by its correlation ID. This endpoint returns the category's properties and content in all available languages.

Endpoint

GET /v1/knowledge-base/categories/{correlationId}

Request Headers

Header

Value

Required

Authorization

Bearer YOUR_API_TOKEN

Yes

Path Parameters

Parameter

Type

Required

Description

correlationId

string

Yes

The correlation ID of the category. Can be custom ID or internal ID prefixed with 'pf_'

Correlation ID Format

  • Custom IDs: Use your own correlation ID as provided during import (e.g., "docs-category")
  • Internal IDs: Use internal database ID prefixed with "pf_" (e.g., "pf_123")

Response Format

Success Response (200 OK)

{
  "id": 123,
  "correlationId": "docs-category",
  "parentCategoryId": null,
  "order": 1,
  "isFeatured": true,
  "icon": "image-guid-123",
  "contents": [
    {
      "lang": "en",
      "title": "Documentation",
      "description": "All documentation and guides",
      "slug": "docs",
      "slug_state": "manual"
    },
    {
      "lang": "es",
      "title": "Documentación",
      "description": "Toda la documentación y guías",
      "slug": "documentacion",
      "slug_state": "auto"
    }
  ]
}

Response Fields

Field

Type

Description

Example

id

number

Internal database ID of the category

123

correlationId

string

Custom correlation ID (if set)

"docs-category"

parentCategoryId

number

Parent category ID (null for root categories)

null

order

number

Display order within parent category

1

isFeatured

boolean

Whether category is featured

true

icon

string

Category icon (CDN image GUID)

"image-guid-123"

contents

array

Category content in different languages

See Content Object below

Content Object (contents[])

Field

Type

Description

Example

lang

string

Language code (ISO 639-1)

"en"

title

string

Category title

"Documentation"

description

string

Category description

"All documentation and guides"

slug

string

URL slug

"docs"

slug_state

string

Slug generation mode: "auto" or "manual"

"manual"

Examples

Example 1: Get Category by Custom Correlation ID

curl -X GET "https://api.productfruits.com/v1/knowledgebase/categories/docs-category" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Response:

{
  "id": 123,
  "correlationId": "docs-category",
  "parentCategoryId": null,
  "order": 1,
  "isFeatured": true,
  "icon": "image-guid-123",
  "contents": [
    {
      "lang": "en",
      "title": "Documentation",
      "description": "Complete documentation and guides",
      "slug": "docs",
      "slug_state": "manual"
    },
    {
      "lang": "es",
      "title": "Documentación",
      "description": "Documentación completa y guías",
      "slug": "documentacion",
      "slug_state": "auto"
    }
  ]
}

Example 2: Get Category by Internal ID

curl -X GET "https://api.productfruits.com/v1/knowledgebase/categories/pf_123" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Response:

{
  "id": 123,
  "correlationId": "docs-category",
  "parentCategoryId": null,
  "order": 1,
  "isFeatured": true,
  "icon": "image-guid-123",
  "contents": [
    {
      "lang": "en",
      "title": "Documentation",
      "description": "Complete documentation and guides",
      "slug": "docs",
      "slug_state": "manual"
    }
  ]
}

Example 3: Error Handling Example

curl -X GET "https://api.productfruits.com/v1/knowledgebase/categories/non-existent-category" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Response (404 Not Found):

{
  "error": "Category with correlation ID 'non-existent-category' not found"
}

Common Use Cases

Category Validation

Verify that a specific category exists before performing operations:

  • Check category properties before updates
  • Validate correlation IDs before referencing in article imports
  • Confirm category hierarchy relationships

Content Localization Planning

Review category content across languages:

  • Identify missing translations for specific categories
  • Check slug consistency across languages
  • Plan localization efforts for category content

Integration Synchronization

Synchronize category data with external systems:

  • Retrieve current category state for comparison
  • Validate category properties after imports
  • Maintain consistency between systems

Hierarchy Analysis

Understand category relationships and structure:

  • Check parent-child relationships
  • Verify category ordering within hierarchies
  • Analyze featured category status

Best Practices

  • Validate Before Operations: Check category exists before referencing in other operations
  • Handle Missing Categories: Implement proper error handling for non-existent categories
  • Cache Category Data: Store frequently accessed category information locally
  • Monitor Changes: Use this endpoint to detect changes in category structure
  • Verify Correlation IDs: Confirm correlation ID format and existence before API calls

Common Error Scenarios

Category Not Found

Cause: Using incorrect correlation ID or category doesn't exist
Solution: Verify correlation ID using GET /categories endpoint first

Invalid Correlation ID Format

Cause: Malformed correlation ID or incorrect internal ID prefix
Solution: Use proper format (custom ID or "pf_" + internal ID)

Authentication Issues

Cause: Invalid or expired API token
Solution: Regenerate API token and update authorization header

Permission Issues

Cause: API token lacks category read permissions
Solution: Check API token permissions and user roles

Error Response Examples

400 Bad Request - Missing Correlation ID

{
  "error": "Correlation ID is required"
}

401 Unauthorized

{
  "error": "Authentication required or invalid API token"
}

404 Not Found

{
  "error": "Category with correlation ID 'invalid-id' not found"
}

500 Internal Server Error

{
  "error": "Internal server error occurred while retrieving category"
}

Rate Limiting

For detailed information about API limits and optimization strategies, please refer to this guide.

Was this article helpful?