Prerequisites
Before starting your migration:- Obtain your v3 API token.
- Review the API changes v2 vs v3.
- Have Python with the
requests
library installed.
Basic setup
To get started, change authentication and base URLs:Search endpoint migration
The search endpoint enables news search with enhanced filtering capabilities in v3. Key changes include parameter renaming, updated response fields, and new filtering options.Parameter changes
1
Rename date parameters
Replace
from
and to
with from_
and to_
respectively:2
Update topic to theme
Replace
topic
with theme
and enable NLP:3
Update search fields
Replace
search_in
format:Complete search example
Usage example
Response structure changes
Latest headlines migration
The latest headlines endpoint provides access to recent news articles. Migration involves similar parameter updates as the search endpoint, with additional time-based filtering options.Parameter changes
1
Update topic to theme
Replace
topic
with theme
and enable NLP:2
Time range specification
Optionally specify time range with the
when
parameter:Complete latest headlines example
Usage example
Additional filtering options
V3 provides enhanced filtering capabilities for latest headlines:For a complete list of
/latest_headlines
parameters, see the Latest
headlines
reference documentation.Response structure changes
Sources endpoint migration
The sources endpoint in v3 provides enhanced metadata about news sources. Key changes include the removal of thetopic
parameter and introduction of new
filtering capabilities.
Parameter changes
1
Remove topic parameter
The
topic
parameter is removed in v3. Instead, use new filtering options:2
Enable additional metadata
Use
include_additional_info
to get enhanced source information:Complete sources example
Usage example
Advanced filtering options
V3 provides additional parameters for precise source filtering:Response structure changes
Next steps
- Test your migrated implementation.
- Review How-to documentation for v3 usage.
- Explore News API v3 endpoints for additional capabilities.