Api News
Api News
Connect your website to fresh articles from MIS RYOUM. Get a personal API key, browse categories, and import headlines, images, article content and source links using simple JSON endpoints.
Get Your API KeyGet your API key
Enter your website details. The key will be restricted to the website origin you provide for browser-based requests. Server-side integrations can use the same key securely from your server.
By generating a key, you agree to keep it private, respect copyright and attribution, and follow the hourly request limit.
What can you retrieve?
Website name, URL, description, language and API version.
Category ID, name, slug, description, article count and category URL.
Title, featured image, full article HTML, category, excerpt, source name, source URL and original article link.
API endpoints
https://misryoum.com/wp-json/api-news/v1/site
https://misryoum.com/wp-json/api-news/v1/categories
https://misryoum.com/wp-json/api-news/v1/posts
20 articles maximum for the general feed, or 8 articles maximum when category is selected.
Request options
| Parameter | Description | Example |
|---|---|---|
key | API key (for simple browser GET requests) | ?key=YOUR_API_KEY |
category | Category ID or slug. Limits the response to 8 articles. | category=world |
limit | Requested number of articles, within the service limits. | limit=10 |
page | Pagination page. | page=2 |
Server integrations should send the key in the Authorization: Bearer YOUR_API_KEY or X-API-Key header. Browser examples use the key query parameter and are restricted to the registered website origin.
WordPress automatic news importer
Prefer automatic publishing instead of writing integration code? Install our companion WordPress plugin, enter your API URL and key, choose a source category, then select the sync schedule and whether imported articles should be saved as drafts or published automatically.
Download WordPress Importer PluginIn WordPress, open Plugins → Add New → Upload Plugin, choose the ZIP, activate it, and configure the settings from the “مستورد الأخبار” menu.
Four ready-to-use integration scripts
Replace YOUR_SOURCE_DOMAIN and YOUR_API_KEY with your own values. Keep the key on your server whenever possible.
1. Simple HTML + JavaScript news widget
<div id="api-news-feed">Loading news...</div>
<script>
const API_BASE = "https://misryoum.com/wp-json/api-news/v1";
const API_KEY = "YOUR_API_KEY";
const CATEGORY = ""; // Use a category ID or slug, or leave empty for all news.
const feed = document.getElementById("api-news-feed");
const params = new URLSearchParams({key: API_KEY, limit: CATEGORY ? 8 : 20});
if (CATEGORY) params.set("category", CATEGORY);
fetch(`${API_BASE}/posts?${params.toString()}`)
.then(response => {
if (!response.ok) throw new Error(`API error: ${response.status}`);
return response.json();
})
.then(data => {
feed.textContent = "";
data.posts.forEach(post => {
const article = document.createElement("article");
article.style.margin = "0 0 24px";
if (post.featured_image && /^https?:\/\//i.test(post.featured_image)) {
const image = document.createElement("img");
image.src = post.featured_image;
image.alt = "";
image.style.cssText = "width:100%;max-width:420px;height:auto";
article.appendChild(image);
}
const heading = document.createElement("h2");
const link = document.createElement("a");
link.href = post.permalink;
link.target = "_blank";
link.rel = "noopener";
link.textContent = post.title;
heading.appendChild(link);
article.appendChild(heading);
const excerpt = document.createElement("p");
excerpt.textContent = post.excerpt || "";
article.appendChild(excerpt);
const source = document.createElement("small");
source.textContent = `Source: ${post.source_name || ""}`;
article.appendChild(source);
feed.appendChild(article);
});
})
.catch(error => feed.textContent = error.message);
</script>
This is a browser-side example. The key is visible to visitors, so use it only with the registered website origin and revoke it if exposed.
2. Plain PHP server-side example
<?php
$apiBase = 'https://misryoum.com/wp-json/api-news/v1';
$apiKey = 'YOUR_API_KEY';
$url = $apiBase . '/posts?limit=20';
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 20,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . $apiKey],
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status !== 200 || !$response) {
throw new RuntimeException('News API request failed: ' . $status);
}
$data = json_decode($response, true);
foreach (($data['posts'] ?? []) as $post) {
echo '<h2>' . htmlspecialchars($post['title'], ENT_QUOTES, 'UTF-8') . '</h2>';
echo '<p>' . htmlspecialchars($post['excerpt'], ENT_QUOTES, 'UTF-8') . '</p>';
}
?>
3. WordPress shortcode example
add_shortcode('remote_news', function () {
$api_url = 'https://misryoum.com/wp-json/api-news/v1/posts?limit=20';
$api_key = 'YOUR_API_KEY'; // Keep this in PHP, never in browser JavaScript.
$response = wp_remote_get($api_url, [
'timeout' => 20,
'headers' => ['X-API-Key' => $api_key],
]);
if (is_wp_error($response) || wp_remote_retrieve_response_code($response) !== 200) {
return '<p>News feed is temporarily unavailable.</p>';
}
$data = json_decode(wp_remote_retrieve_body($response), true);
$html = '<div class="remote-news">';
foreach (($data['posts'] ?? []) as $post) {
$html .= '<article><h3><a href="' . esc_url($post['permalink']) . '">' . esc_html($post['title']) . '</a></h3>';
$html .= '<p>' . esc_html($post['excerpt']) . '</p></article>';
}
return $html . '</div>';
});
// Add [remote_news] to any WordPress page or post.
4. Node.js / server example
const API_BASE = "https://misryoum.com/wp-json/api-news/v1";
const API_KEY = "YOUR_API_KEY";
async function loadNews() {
const response = await fetch(`${API_BASE}/posts?limit=20`, {
headers: { "X-API-Key": API_KEY }
});
if (!response.ok) throw new Error(`News API error: ${response.status}`);
const data = await response.json();
return data.posts;
}
loadNews()
.then(posts => console.log(posts))
.catch(console.error);
Usage, limits and attribution
- Each API key has its own request counter and hourly limit.
- The general feed returns up to 20 latest published posts per request.
- A category feed returns up to 8 latest published posts per request.
- Each article response includes the original source website and article URL, plus the custom attribution text configured by the website owner.
- Do not remove source attribution or republish content unless you have the necessary rights or permission.