Transform your data needs with precise location-specific news content! This guide helps you make your first API call to access local news articles with powerful location detection and filtering capabilities.

Before you start

Before you begin, make sure you meet these prerequisites:

  • An API key (obtain one through our pricing page)
  • Basic understanding of REST APIs
  • Your preferred programming language and HTTP client
  • Basic knowledge of JSON data format

Steps

1

Set up your environment

Make sure you have the necessary HTTP client library installed for your programming language:

# cURL is typically included in your system
# To check, open the terminal and type the following:
curl --version
2

Create your first script

Run the curl command in your terminal, use JSON for the request body in Postman, or create a script to fetch local news articles:

curl -X POST https://local-news.newscatcherapi.com/api/search \
  -H "x-api-token: YOUR_API_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "q": "*",
    "locations": ["San Francisco, California"],
    "detection_methods": ["local_section", "ai_extracted"],
    "theme": "Tech",
    "lang": "en",
    "from_": "7 days ago"
  }'

Remember to replace YOUR_API_KEY_HERE with your actual API key.

3

Review the results

When you run the script, you receive a JSON response like this (shortened for readability):

JSON
{
  "status": "ok",
  "total_hits": 51,
  "page": 1,
  "total_pages": 1,
  "page_size": 100,
  "articles": [
    {
      "id": "d156bb26af2b39ed33bd96b8428b4b21",
      "locations": [
        {
          "name": "San Francisco, California",
          "detection_methods": ["local_section"]
        }
      ],
      "title": "Researchers say an AI-powered transcription tool used in hospitals invents things no one ever said",
      "link": "https://www.sfchronicle.com/business/article/researchers-say-an-ai-powered-transcription-tool-19864411.php",
      "published_date": "2024-10-26 04:15:41",
      "domain_url": "sfchronicle.com",
      // ... other fields
      "nlp": {
        "theme": ["Tech", "Science"],
        "summary": "Whisper, an AI-powered transcription tool, is prone to making up chunks of text or entire sentences. It's being used in industries worldwide to translate and transcribe interviews, generate text in popular consumer technologies and create subtitles for videos.",
        "sentiment": {
          "title": 0.8877,
          "content": -0.9958
        },
        // ... nlp other fields
      }
    }
  ],
}

The response shows location-specific articles with rich metadata, including location detection methods, NLP analysis, and article details.

What’s next

Now that you’ve made your first calls to the Local News API, here are some next steps:

  1. Learn about Advanced querying to refine your searches
  2. Explore Location detection methods for better location matching
  3. Read about NLP features to extract insights from articles
Need help? Contact our support team at support@newscatcherapi.com