Skip to main content

Usage

This page provides examples and API reference for using the Zendesk Help Center integration for articles.

API Endpoints

The Zendesk Help Center integration is automatically available when installed in the API Harmonization server. It provides standard article endpoints that follow the framework's article API specification.

List Articles

Retrieve a list of articles with optional filtering and pagination.

Endpoint: GET /articles

Query Parameters:

ParameterTypeDescriptionRequired
localestringLanguage code (en, de, pl)Yes
categorystringFilter by category ID or slugNo
offsetnumberPagination offsetNo
limitnumberNumber of articles per page (default: 10)No
sortBystringSort fieldNo
sortOrderstringSort direction (asc, desc)No

Example Request:

GET /articles?locale=en&limit=10&offset=0

Example Response:

{
"total": 25,
"data": [
{
"id": "12345",
"slug": "67890-Maintenance/12345-Tool-Care-Guide",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-16T14:20:00Z",
"title": "Tool Care Guide",
"lead": "Learn how to properly maintain your tools for optimal performance...",
"tags": ["maintenance", "tools", "guide"],
"thumbnail": {
"url": "https://zendesk.com/attachments/thumbnail.jpg",
"alt": "Tool maintenance"
},
"author": {
"name": "John Doe",
"position": "admin",
"avatar": {
"url": "https://zendesk.com/photos/johndoe.jpg",
"alt": ""
}
}
}
]
}

Get Single Article

Retrieve a specific article by slug with full content.

Endpoint: GET /articles/:slug

Path Parameters:

ParameterTypeDescriptionRequired
slugstringArticle slug or ID (e.g., "12345-article-title")Yes

Query Parameters:

ParameterTypeDescriptionRequired
localestringLanguage code (en, de, pl)Yes

Example Request:

GET /articles/12345-tool-care-guide?locale=en

Example Response:

{
"id": "12345",
"slug": "67890-Maintenance/12345-Tool-Care-Guide",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-16T14:20:00Z",
"title": "Tool Care Guide",
"lead": "Learn how to properly maintain your tools for optimal performance...",
"tags": ["maintenance", "tools", "guide"],
"image": {
"url": "https://zendesk.com/attachments/featured.jpg",
"alt": "Tool maintenance"
},
"thumbnail": {
"url": "https://zendesk.com/attachments/thumbnail.jpg",
"alt": "Tool maintenance"
},
"category": {
"id": "67890",
"title": "Maintenance"
},
"author": {
"name": "John Doe",
"email": "john@example.com",
"position": "admin",
"avatar": {
"url": "https://zendesk.com/photos/johndoe.jpg",
"alt": ""
}
},
"sections": [
{
"id": "section-text-12345",
"__typename": "ArticleSectionText",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-16T14:20:00Z",
"content": "<h1>Tool Care Guide</h1><p>Proper maintenance is essential...</p>"
}
]
}

List Categories

Retrieve a list of categories.

Endpoint: GET /articles/categories

Query Parameters:

ParameterTypeDescriptionRequired
localestringLanguage code (en, de, pl)Yes
offsetnumberPagination offsetNo
limitnumberNumber of categoriesNo

Example Request:

GET /articles/categories?locale=en

Example Response:

{
"total": 5,
"data": [
{
"id": "67890",
"slug": "67890-Maintenance",
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-10T00:00:00Z",
"title": "Maintenance",
"description": "Maintenance guides and tutorials"
}
]
}

Get Single Category

Retrieve a specific category by ID or slug.

Endpoint: GET /articles/categories/:id

Path Parameters:

ParameterTypeDescriptionRequired
idstringCategory ID or slugYes

Query Parameters:

ParameterTypeDescriptionRequired
localestringLanguage code (en, de, pl)Yes

Example Request:

GET /articles/categories/67890?locale=en

Example Response:

{
"id": "67890",
"slug": "67890-Maintenance",
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-10T00:00:00Z",
"title": "Maintenance",
"description": "Maintenance guides and tutorials"
}

Search Articles

Search articles with full-text query.

Endpoint: POST /articles/search

Body Parameters:

ParameterTypeDescriptionRequired
localestringLanguage code (en, de, pl)Yes
querystringSearch queryNo
categorystringFilter by category IDNo
dateFromstringFilter articles created after (ISO)No
dateTostringFilter articles created before (ISO)No
sortBystringSort fieldNo
sortOrderstringSort direction (asc, desc)No

Example Request:

POST /articles/search
Content-Type: application/json

{
"locale": "en",
"query": "maintenance guide",
"category": "67890"
}

Example Response:

{
"total": 3,
"data": [
{
"id": "12345",
"slug": "67890-Maintenance/12345-Tool-Care-Guide",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-16T14:20:00Z",
"title": "Tool Care Guide",
"lead": "Learn how to properly maintain your tools...",
"tags": ["maintenance", "tools"]
}
]
}

Locale Handling

The integration automatically maps application locales to Zendesk Help Center format:

Application RequestZendesk API Call
locale=enlocale=en-us
locale=delocale=de-de
locale=pllocale=pl

You should always use the short locale format (en, de, pl) in your API requests.

Slug Format

Article slugs returned by the Zendesk integration contain the category and article segments:

{category-id}-{category-name}/{article-id}-{article-title}

Example slugs returned by the integration:

TypeSlug Example
Article67890-Maintenance/12345-Tool-Care-Guide
Category67890-Maintenance

The base path (e.g., /help-and-support, /hilfe-und-support) is configured separately in CMS block configuration via parent.slug property, not hardcoded in the integration. This allows the same integration to work with different URL structures.

Filtering Examples

Filter by Category

Get articles from a specific category:

GET /articles?locale=en&category=67890

Or using category slug:

GET /articles?locale=en&category=maintenance

Pagination

Get the second page of results:

GET /articles?locale=en&limit=10&offset=10

Combined Filters

Get articles from maintenance category with pagination:

GET /articles?locale=en&category=67890&limit=20&offset=0

Best Practices

1. Always Specify Locale

Always include the locale parameter in your requests:

// ✓ Good
const articles = await getArticleList({ locale: 'en' });

// ✗ Bad - might get wrong language
const articles = await getArticleList({});

2. Handle Undefined Responses

Always check if the response is undefined before accessing article properties:

const article = await getArticle({ slug, locale });
if (!article) {
// Handle article not found
return;
}
// Use article safely

3. Use Pagination

For large article lists, always use pagination:

const articles = await getArticleList({
locale: 'en',
limit: 20,
offset: 0,
});

// Load more
const moreArticles = await getArticleList({
locale: 'en',
limit: 20,
offset: 20,
});

4. Cache Article Lists

Consider caching article lists to reduce API calls:

const cacheKey = `articles:${locale}:${category}`;
const cached = await cache.get(cacheKey);
if (cached) {
return cached;
}

const articles = await getArticleList({ locale, category });
await cache.set(cacheKey, articles, 300); // 5 minutes

5. Pre-fetch Categories

If you need category information for multiple articles, fetch categories once:

// Fetch all categories once
const categories = await getCategoryList({ locale });

// Use for display
articles.forEach((article) => {
const category = categories.data.find((c) => c.id === article.category?.id);
// Use category details
});

Integration with Frontend

The Zendesk Help Center integration works seamlessly with the O2S frontend SDK:

import { sdk } from '@/api/sdk';

// Get article list
const articles = await sdk.articles.getArticleList({
locale: 'en',
limit: 20,
});

// Get single article
const article = await sdk.articles.getArticle({
slug: '12345-tool-care-guide',
locale: 'en',
});

// Search articles
const searchResults = await sdk.articles.searchArticles({
locale: 'en',
query: 'maintenance',
});

// Get categories
const categories = await sdk.articles.getCategoryList({
locale: 'en',
});

The SDK automatically handles:

  • Locale mapping
  • Error handling
  • Response normalization
  • Type safety