API Documentation

Overview

This API allows clients to retrieve news and source information based on various parameters. It requires API key authentication and is rate-limited based on the user's plan.

Authentication

All API requests require the use of an API key in the request headers. API keys are to be included as follows:

Authorization: Bearer {api_key}

Endpoints

GET /api/news

Retrieves news entries based on filter parameters.

Parameters:

  • start_date: The start date for the news entries (YYYY-MM-DD).
  • end_date: The end date for the news entries (YYYY-MM-DD).
  • media_id: The ID of the media source.
  • source_id: The ID of the news source.
  • keyword: A keyword to filter news entries.
  • topic_name: The name of the topic to filter by.
  • limit: Maximum number of results (capped at 100).

Example Request:

GET https://mosaik.news/api/news?start_date=2023-05-11&end_date=2024-05-10&media_id=1&source_id=1&keyword=&topic_name=business&limit=50

Example Response:

{
                "articleCount": 1,
                "articles": [
                  {
                    "author": "Melissa Davey",
                    "description": "Description here...",
                    "headline": "AstraZeneca withdraws...",
                    "id": 137,
                    "link": "https://mosaik.news...",
                    "pubDate": "Wed, 08 May 2024 02:18:56 GMT",
                    "source": {
                      "name": "The Guardian",
                      "detail": "Science",
                      "media_id": 1,
                      "source_id": 1
                    },
                    "topics": ["Business", "Health"]
                  }
                ],
                "message": "Data retrieved successfully",
                "status": "success"
                }

GET /api/sources

Retrieves available media and their news sources.

Example Request:

GET https://mosaik.news/api/sources

Example Response:

[
                  {
                    "id": 1,
                    "name": "The Guardian",
                    "sources": [
                      {"id": 1, "name": "Energy & Environment", "url": "https://www.theguardian.com"}
                    ]
                  }
                  ]