Familiarizing with the ‘Region Parameter’
The Newsdata.io platform recently launched a new parameter named the ‘Region’ parameter to increase data extraction efficiency. The specified geographic region cut down chunks of irrelevant data and ensures precision in data extraction.
All about the ‘Region’ parameter
This section of the blog will focus on the working of the parameter.
What is the new ‘Region’ parameter about?
The ‘Region’ parameter allows you to set the geographical location for relevant data. Like other pre-existing parameters, the key function is to increase the overall efficiency.
This new parameter allows you to narrow down the region you want the data from. It can be a city, state, region, country, or even a continent.
For instance, you want articles related to Nashville City of Tennessee State of the United States of America Country. The request parameter of the same would be:
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=nashville-tennessee-united states of america
This will fetch you all the articles related to Nashville City of Tennessee State of the United States of America.
NOTE: If you mention just Nashville City (region=nashville), it will fetch articles related to all the locations around the world named Nashville. So, in order to fetch articles from Nashville City of Tennessee state of the United States of America, you should mention the whole geographical location (region=nashville-tennessee-unites states of america).
NOTE: This parameter allows the user to add up to 5 geographical locations in a single query. Such that, you can still add 4 more geographical locations to the given query.
Who can access the ‘Region’ parameter?
Only corporate users can access the newly launched ‘Region’ parameter. Furthermore, this parameter is available only in the “news” endpoint.
Country Filter VS Region Parameter
If there already exists a ‘country’ filter then why another parameter? To answer that query, go through the table of differences inserted below:
Points of Difference | ‘Country’ Parameter | ‘Region’ Parameter |
---|---|---|
Basic Function | This filter allows the user to specify the country of the publisher, he wants data to be fetched from. | This parameter allows the user to specify the city, state, region, country, and continent of the news articles are being fetched from. |
Availability | It is available for all users. | It is available for only corporate users. |
API Endpoint | This filter is available while fetching all kinds of API endpoints. | This parameter is available while fetching only the “news” API endpoint. |
Preciseness | This filter provides less precise data as compared to the ‘Region’ filter | This parameter provides more precise data by letting the user specify the location of city, state, and even region. |
Local News | This filter does not fetch local news. | This parameter fetches the local news as well. |
Request Parameter | country=us | region=nashville-tennessee-usa-north america |
Let’s understand Region Parameter with examples
To help understand better, given below is a set of examples explaining different ways this parameter can be used.
1. City-State-Country
- For instance, you want articles from City: Nashville, State: Tennessee, Country: United States of America. The request parameter for that would be
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=nashville-tennessee-united states of america
This would fetch all the available data from Nashville City of Tennessee State of United States of America. - If you want articles from City: Seattle, State: Washington, Country: United States of America, then the request parameter would be
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=seattle-washington-united states of america
This would fetch all the available data from the Seattle City of Washington State of the United States of America.
2. City-State
- For instance, you want articles from City: Nashville, State: Tennessee. The request parameter for that would be
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=nashville-tennessee
This would fetch all the available data from the Nashville City of the Tennessee State.
NOTE: The given request parameter will fetch articles from all the locations around the world named Nashville, Tennessee. If you want articles from Nashville City of Tennessee State of the United States of America specifically, you will have to mention the country as well.
- If you want articles from City: Seattle, State: Washington, then the request parameter would be
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=seattle-washington
This would fetch all the available data from the Seattle City of Washington State only.
NOTE: The given request parameter will fetch articles from all the locations around the world named Seattle, Washington. If you want articles from Seattle City of Washington State of the United States of America specifically, you will have to mention the country as well.
3. City-Country
- For instance, you want articles from City: Nashville, Country: United States of America. The request parameter would be
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=nashville-united states of america
This would fetch all the available data from the Nashville City of United States of America only. - If you want articles from City: Seattle, Country: United States of America, then the request parameter would be
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=seattle-united states of america
This would fetch all the available data from the Seattle City of United States of America only.
4. State-Country
- For instance, you want articles from State: Tennessee, Country: United States of America. The request parameter would be
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=tennessee-united states of america
This would fetch all the available data from the Tennessee State of United States of America only. - If you want articles from State: Washington, Country: United States of America, then the request parameter would be
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=washington-united states of america
This would fetch all the available data from the Washington State of United States of America only.
5. City-State-Country-Continent
- For instance, you want articles from City: Nashville, State: Tennessee, Country: United States of America, Continent: North America. The request parameter would be
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=nashville-tennessee-united states of america-north america
This would fetch all the available data from the Nashville City of Tennessee State of United States of America of North America Continent. - If you want articles from City: Seattle, State: Washington, Country: United States of America, Continent: North America, then the request parameter would be
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=seattle-washington-united states of america-north america
This would fetch all the available data from the Seattle City of Washington State of United States of America of North America Continent.
- For instance, you want articles from City: Nashville, State: Tennessee, Country: United States of America, Continent: North America. The request parameter would be
6. Multiple Geographical Locations
- For instance, you want articles from ‘City: Nashville, State: Tennessee, Country: United States of America’, ‘City: Seattle, State: Washington’, and ‘State: Illinois, Country: United States of America, Continent: North America’. The request parameter would be
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=nashville-tennessee-united states of america, seattle-washington, illinois-united states of america-north america
This would fetch all the available data from all the mentioned geographical locations. - If you want articles from ‘City: San Francisco, State: California, Country: United States of America’, ‘City: Portland, State: Oregon’ and ‘State: Tennessee, Country: United States of America, Continent: North America’, then the request parameter would be
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=san francisco-california-united states of america, portland-oregon, tennessee-united states of america-north america
This would fetch all the available data from all the mentioned geographical locations.
- For instance, you want articles from ‘City: Nashville, State: Tennessee, Country: United States of America’, ‘City: Seattle, State: Washington’, and ‘State: Illinois, Country: United States of America, Continent: North America’. The request parameter would be
Quick Tips to Remember
Mentioned below are some quick tips to ensure efficient utilization of the new parameter.
1. Spacing
In the case of two or more worded cities/states/countries/continents/regions, proper space is given among the words to avoid any confusion.
For instance, you want data from Nashville city, United States of America country. Then the request parameter would be
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=nashville-united states of america
2. Number of Geographical Locations
The number of geographical locations you use in a single query impacts the success of your request as well. You can use up to five different geographical locations in a single query.
For instance, if you want data from 5 different geographical locations, then the request parameter would be
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=nashville-tennessee-usa,newcastle upon tyne-england,chicago-united states of america,san francisco-california,london-united kingdom-europe
The given parameter will fetch information from the five different locations simultaneously.
NOTE: If you try to add more locations, there will be an error and the request will fail.
3. Correct use of “,” and “_”
You must note that ‘,’ is used to segregate two parameters whereas “_” is used within a single parameter.
For Instance, you want data from ‘City: Nashville, State: Tennessee’ and ‘City: Chicago, Country: United States of America’. The request parameter would be
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=nashville-tennessee,chicago-united states of america
In the given request parameter, “,” is used to separate 2 different region parameters and ‘_’ is used to specify Nashville of Tennessee State.
4. Complete Information
There is always a possibility of wasted API credits due to a lack of complete information. There are cities with the same name but different countries, which if not specified can lead to confusion.
For instance, you want data from City: Beverly Hills, State: California.
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=beverly hills
The given request parameter will fetch data from City: Beverly Hills, State: California as well as City: Beverly Hills, State: Texas.
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=beverly hills-california
The given request parameter will now fetch data from Beverly Hills City of California State. Thus, avoiding any confusion by specifying the complete location.
5. Complete names
One more thing that you should keep in mind is to always insert the full name of the geographical location. Inserting short forms of the cities/states/countries/continents/regions can lead to failure of the request.
For instance, you want data from State: New York, Country: United States of America.
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=ny-united states of america
There will be a failure with the given request due to the use of short forms.
https://newsdata.io/api/1/news?apikey=Your_API_Key&q=pizza®ion=new york-united states of america
The given request will now fetch your data from New York City of United States of America.
NOTE: Except Washington D.C. all other cities, states, countries, continents, and regions should be inserted with their original full names.
Frequently Asked Questions
Q1. What is the recently launched ‘Region Parameter’ of Newsdata.io?
The new ‘Region’ parameter allows the user to be more precise about the geographical location they want their data to be fetched from.
Q2. Can I use multiple region parameters in a single query?
Yes, you can use up to five different region parameters in a single query.
Q3. Does the new parameter improve the accuracy of data extraction?
Yes, the new ‘Region’ parameter enables users to set the geographical location accordingly. Thus, improving the accuracy of the data.
Q4. What are the limitations of the new region parameter?
The only limitation of this parameter is that it is made available only to users with corporate plans. Any other user won’t be able to access it without upgrading their plan.
Q5. Can I use the region parameter to fetch local news?
Yes, unlike the ‘country’ filter you can use the ‘region’ parameter to fetch local news as well.
Q6. What happens if I use ‘USA’ instead of ‘United States of America’ while using the region parameter?
If you use ‘USA’ instead of ‘United States of America’ the API will face some issues while fetching the data. As a result, you might not receive the articles from your desired geographical location.
Hello, Curious Minds!
Welcome to my corner of the digital world, a space brimming with words and woven with ideas. Fresh out of the rigorous trenches of an Economics honors degree at the esteemed University of Delhi, I know a thing or two about crunching numbers and dissecting trends. But beyond the world of graphs and equations, lies my love for reading and writing. Admittedly, I’m a newbie in the content writing scene, still tasting the ink of fresh beginnings. I believe every corner of life holds a story waiting to be told, and I’m eager to be your storyteller. So, strap yourselves in, dear readers, and let’s dive into the captivating world of words together!
P.S. Feel free to drop a comment or reach out – I’m always up for a good conversation!