API Documentation
Comprehensive guides and examples to help you integrate LiveBlogStream into your applications. Get started quickly with our detailed API reference and SDKs.
Quick Navigation
Getting Started
Quick setup guide and first API call
API Reference
Complete endpoint documentation
Feed API
High-performance feed endpoint with caching
SDKs & Libraries
Official SDKs for popular languages
Examples
Integration examples and use cases
Webhooks
Real-time event notifications
Support
Get help and contact information
Getting Started
Quick Setup
Follow these steps to integrate LiveBlogStream into your application:
1. Get Your API Key
First, create an account and generate an API key in your dashboard.
2. Make Your First Request
curl -X GET "https://api.liveblogstream.com/api/feeds" \
-H "Authorization: Bearer YOUR_API_KEY"
3. Create Your First Post
curl -X POST "https://api.liveblogstream.com/api/feeds/FEED_ID/posts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Breaking News",
"content": "This is a live update...",
"status": "published"
}'
API Reference
Authentication
All API requests require authentication using your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Base URL
https://api.liveblogstream.com/api
Endpoints
GET /feeds
List all your feeds
curl -X GET "https://api.liveblogstream.com/api/feeds" \
-H "Authorization: Bearer YOUR_API_KEY"
POST /feeds
Create a new feed
curl -X POST "https://api.liveblogstream.com/api/feeds" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "My Live Blog",
"description": "Live updates from the event"
}'
GET /feeds/{id}/posts
Get posts from a specific feed
curl -X GET "https://api.liveblogstream.com/api/feeds/FEED_ID/posts" \
-H "Authorization: Bearer YOUR_API_KEY"
POST /feeds/{id}/posts
Create a new post in a feed
curl -X POST "https://api.liveblogstream.com/api/feeds/FEED_ID/posts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Update Title",
"content": "Post content here...",
"status": "published"
}'
Feed API
High-performance API endpoint for retrieving feed posts with intelligent memcached caching and database fallback.
Overview
Lightning Fast
Sub-5ms response times with memcached caching
Secure
SQL injection prevention with prepared statements
Smart Caching
Automatic cache management with database fallback
Flexible
Supports GET, POST, and JSON requests
Endpoint
URL
POST/GET https://api.liveblogstream.com/feed_api.php
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
company_id |
integer | ✓ | Company identifier |
feed_id |
integer | ✓ | Feed identifier |
last_post_id |
integer | Get posts newer than this ID |
Request Examples
GET Request
curl -X GET "https://api.liveblogstream.com/feed_api.php?company_id=1&feed_id=123"
POST Request (JSON)
curl -X POST "https://api.liveblogstream.com/feed_api.php" \
-H "Content-Type: application/json" \
-d '{
"company_id": 1,
"feed_id": 123
}'
Incremental Updates
curl -X GET "https://api.liveblogstream.com/feed_api.php?company_id=1&feed_id=123&last_post_id=500"
Response Format
Success Response
{
"status": "success",
"company_id": 1,
"feed_id": 123,
"posts": [
{
"post_id": 501,
"title": "Breaking News: Major Sports Update",
"content": "<p>Full article content here...</p>",
"excerpt": "Brief summary of the article",
"author_name": "John Doe",
"category": "Sports",
"published_at": "2024-01-15 14:30:00",
"stats": {
"view_count": 1250,
"like_count": 89,
"engagement_score": 8.7
}
}
],
"cached": true,
"timestamp": "2024-01-15T14:35:00+00:00"
}
Performance
Cache Hit
< 5msResponse time
Throughput
1000+Requests/second
Cache Size
15 postsPer feed
TTL
60 secCache expiry
JavaScript Integration
async function fetchFeedPosts(companyId, feedId) {
const response = await fetch('https://api.liveblogstream.com/feed_api.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ company_id: companyId, feed_id: feedId })
});
const data = await response.json();
return data.status === 'success' ? data.posts : [];
}
// Usage
fetchFeedPosts(1, 123).then(posts => {
posts.forEach(post => console.log(post.title));
});
last_post_id
for incremental updates to minimize data transfer.
SDKs & Libraries
Use our official SDKs to integrate LiveBlogStream into your applications quickly and easily.
JavaScript
npm install @liveblogstream/js-sdk
import { LiveBlogStream } from '@liveblogstream/js-sdk';
const lbs = new LiveBlogStream('YOUR_API_KEY');
const feeds = await lbs.feeds.list();
Python
pip install liveblogstream
import liveblogstream
lbs = liveblogstream.Client('YOUR_API_KEY')
feeds = lbs.feeds.list()
PHP
composer require liveblogstream/php-sdk
$lbs = new LiveBlogStream\Client('YOUR_API_KEY');
$feeds = $lbs->feeds->list();
Examples
Common integration patterns and use cases for LiveBlogStream.
WordPress Integration
Add this to your WordPress theme to display live updates:
<?php
$api_key = 'YOUR_API_KEY';
$feed_id = 'YOUR_FEED_ID';
$response = wp_remote_get(
"https://api.liveblogstream.com/api/feeds/{$feed_id}/posts",
array(
'headers' => array(
'Authorization' => "Bearer {$api_key}"
)
)
);
$posts = json_decode(wp_remote_retrieve_body($response), true);
foreach ($posts['data'] as $post) {
echo "<div class='live-post'>";
echo "<h3>{$post['title']}</h3>";
echo "<p>{$post['content']}</p>";
echo "</div>";
}
?>
React Component
Create a React component for live updates:
import React, { useState, useEffect } from 'react';
import { LiveBlogStream } from '@liveblogstream/js-sdk';
function LiveBlog({ feedId, apiKey }) {
const [posts, setPosts] = useState([]);
const lbs = new LiveBlogStream(apiKey);
useEffect(() => {
const fetchPosts = async () => {
const response = await lbs.feeds.getPosts(feedId);
setPosts(response.data);
};
fetchPosts();
const interval = setInterval(fetchPosts, 30000); // Update every 30s
return () => clearInterval(interval);
}, [feedId, apiKey]);
return (
<div className="live-blog">
{posts.map(post => (
<div key={post.id} className="post">
<h3>{post.title}</h3>
<p>{post.content}</p>
</div>
))}
</div>
);
}
Webhooks
Webhooks allow you to receive real-time notifications when events occur in your feeds.
Setting Up Webhooks
Configure your webhook endpoint to receive notifications:
POST https://your-server.com/webhooks/liveblogstream
Content-Type: application/json
X-LBS-Signature: signature
Webhook Events
Available webhook events:
post.created
- New post createdpost.updated
- Post updatedpost.deleted
- Post deletedfeed.created
- New feed createdfeed.updated
- Feed updated
Support
Need help with your integration? We're here to help!
Documentation
Comprehensive guides and tutorials for all features.
Community
Join our developer community for discussions and help.
Contact
Get in touch with our support team for assistance.
Ready to Get Started?
Join thousands of developers who are already using LiveBlogStream to power their live content.