19 - Fetching JSON Response(Part A) or REST API (Part B) using News API Website:
News API is a simple, easy-to-use REST API that returns JSON search results for current and historic news articles published by over 80,000 worldwide sources.
1- Go to News API website( https://newsapi.org/ )
Image 1 - News API Website
2 - Generate an API Key by clicking on GET API Key button and provide informations like FirstName , EmailId , Password with certain validations ,etc.
3 - An API Key will be generated with your account which will be added at the last part of url for API to be functional. Basically used for authentication.
4 - In our url we can set parameters to filter data like country , category , pageSize , page ,etc.
As of now we are setting country=in and category=general
We can basically go to documentation section of webpage & learn details for our API.
Thus our url for GET Response becomes:
5- Our JSON Response for this url is:
6 - We can also view our response by adding an extension to our chrome namely JSON Formatter for better view of JSON Response generated in our chrome page.
Image 2 - JSON Formatter Extension
Comments
Post a Comment