API
Getting Started
Section titled “Getting Started”FeedPal provides a REST API to retrieve your articles programmatically. This API allows you to integrate your FeedPal content into your applications, websites, or other services.
API Key
Section titled “API Key”To use the API, you need to have an API key. You can get your API key by going to the FeedPal dashboard and clicking on “Developer settings”.
Data Types
Section titled “Data Types”Article
Section titled “Article”Represents a single article in your feed.
interface Article { previewImageUrl?: string; // Optional preview image URL publicationDate: string; // ISO date string (depends on your settings) locale: string; // Language/locale code (e.g., 'en', 'es') title: string; // Article title slug: string; // URL-friendly identifier contentPreview: string; // Short preview of the content content?: string; // Full article content (only when request one article)}PaginatedResponse
Section titled “PaginatedResponse”Used for endpoints that return paginated results.
interface PaginatedResponse<T> { content: T[]; // Array of items totalElements: number; // Total number of items page: number; // Current page number totalPages: number; // Total number of pages}ListOptions
Section titled “ListOptions”Options for listing articles.
interface ListOptions { locale?: string; // Filter by language/locale page: number; // Page number (1-based) itemsPerPage?: number; // Items per page (default: 20)}API Endpoints
Section titled “API Endpoints”Base URL
Section titled “Base URL”The base URL is https://back.thefeedpal.app
Authentication
Section titled “Authentication”All API requests require authentication using your API key. You need to add the API key to the Authorization header of all requests.
Example:
const response = await fetch('https://back.thefeedpal.app/api/articles', { headers: { 'Authorization': `Bearer ${apiKey}` }});1. Health Check
Section titled “1. Health Check”Endpoint: GET /api/status
Check if the API is running and accessible.
const status = await feedApiClient.status();console.log(status); // "OK" or error message2. List Articles
Section titled “2. List Articles”Endpoint: GET /api/articles
Retrieve a paginated list of articles.
Query Parameters:
page(required): Page number (1-based)language(optional): Filter by locale (default: ‘en’)pageSize(optional): Number of items per page (default: 20)
Response:
{ "content": [ { "uid": "article-123", "title": "Getting Started with FeedPal", "slug": "getting-started", "contentPreview": "Learn how to set up your first feed...", "publicationDate": "2024-01-15T10:30:00Z", "locale": "en", "previewImageUrl": "https://example.com/image.jpg" } ], "totalElements": 50, "page": 1, "totalPages": 3}3. Get Single Article
Section titled “3. Get Single Article”Endpoint: GET /api/articles/:slug
Retrieve a specific article by its slug.
Path Parameters:
slug(required): The article’s slug
Query Parameters:
language(optional): Filter by locale
Example:
// Get article by slugconst article = await feedApiClient.getArticle({ slug: 'getting-started', locale: 'en'});
if (article) { console.log(article.title); console.log(article.content);}Response:
{ "uid": "article-123", "title": "Getting Started with FeedPal", "slug": "getting-started", "contentPreview": "Learn how to set up your first feed...", "content": "<p>Full article content in HTML format...</p>", "publicationDate": "2024-01-15T10:30:00Z", "locale": "en", "previewImageUrl": "https://example.com/image.jpg"}Examples
Section titled “Examples”Multi-language Support
Section titled “Multi-language Support”// Get articles in different languagesconst englishArticles = await feedApiClient.listArticles({ page: 1, locale: 'en'});
const spanishArticles = await feedApiClient.listArticles({ page: 1, locale: 'es'});Article Detail Page
Section titled “Article Detail Page”// Get full article contentconst article = await feedApiClient.getArticle({ slug: 'my-article-slug', locale: 'en'});
if (article) { // Render full article document.title = article.title; document.getElementById('content').innerHTML = article.content;} else { // Handle article not found document.getElementById('content').innerHTML = '<h1>Article not found</h1>';}