NewsAPIError: parametersIncompatible
See original GitHub issueTried to get news with the following example from official website
const NewsAPI = require('newsapi');
const newsapi = new NewsAPI('7bfd3e755d524648883ebae00d2280f7');
newsapi.v2.topHeadlines({
sources: 'bbc-news,the-verge',
q: 'bitcoin',
category: 'business',
language: 'en',
country: 'us'
}).then(response => {
console.log(response);
/*
{
status: "ok",
articles: [...]
}
*/
});
but keep getting error ‘You cannot mix the sources parameter with the country or category parameters’. When I remove sources I don’t get any articles back. node version 9.11. running on local express server
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Errors - Documentation - News API
The request was executed successfully. 400 - Bad Request . The request was unacceptable, often due to a missing or misconfigured parameter. 401...
Read more >Terms - News API
Accuracy of materials. The materials appearing on News API's website could include technical, typographical, or photographic errors. News API ...
Read more >Everything - Documentation - News API
This parameter is useful if you have an edge case where searching all the fields is ... In the case of error a...
Read more >Errors - Documentation - News API
Guides. By now you may be familiar with the API and how to make requests, but still have questions about how to use...
Read more >Bing News Search API v5 Reference - Microsoft Learn
Describes the v5 iteration of the News Search API and provides technical details about the query parameters to request news articles.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ihorbond Thanks for pointing this out. The example usage of the
v2.topHeadlines
is misleading in that it demonstrates thatsources
,country
, andcategory
are available parameters to pass, but according to the official NewsAPI top-headlines docs,country
andcategory
can not be used simultaneously withsources
.I would guess that the reason you got no articles back after removing
sources
is that there simply were no recent top headlines that were categorized as “business” and contained the query “bitcoin”.I will update my usage examples to address this. I recommend to always refer to the official NewsAPI docs when looking for which parameters are valid and what kind of values they accept.
Can you please update the document, so that no new developer finds these issues again? It will be really helpful.
Thank You