The next stage of my journey with Udacity involved creating an application which takes a JSON feed from an Application Programming Interface (API) and use selective parts of the JSON feed to display news on the app. We used the freely available U.S. Geological survey website API to build an app called “Quake app” which told us where in the world there was an earth quake and of what magnitude – we then created various filters like only show quakes above 5.0 on the Richter Magnitude scale. This was all with code fed to us by Udacity. We then took quake app and used it to create an app for displaying news. We were to:-
- Search the internet for available APIs from official news sources.
- Obtain an API key if necessary.
- Using the quake app as a template, create our news app.
I found the API of the Guardian Newspaper and obtained an API key (a digital key to show that I was authorised to access the API which gets appended to the Uniform Resource Locator (URL) of the API) I had to create an account with the Guardian so that I could apply for an API key. If I had been a company applying for a key, I would have had to pay but because I am a lone developer they allowed me access for free. I have just renewed the key – I think that the original term was for 3 years. I initially created an app which displayed the top news stories in all of their categories.

Like so…….
The News App – Part 2
The next part of the creation of the News App was to create filters so that the user could choose to view the ten most recent headlines across all categories, the ten most recent headlines across Politics, Business, Environment or Sport:-




The settings to allow this are accessed by clicking the “kebab” menu, that is the three vertical dots in the top right hand corner of the news page. The second picture shows the menus and there are two things to choose:-
- Latest or Relevance (to the category chosen).
- All news or a single category as illustrated in the subsequent pictures.
The headlines are shown in real time if you chose “Most Recent” for the chosen category and if you click on the headline you are then taken to the full story on the Guardian Website so that you can read it.
Finally, I gave it the name “Here is the News” and created an Icon to make it stand out from other apps on my device. I up-loaded the code to my GitHub repository where it remains together with the code from my other apps – including the ones that I have not told you about yet! There’s more to come!