For our very first assignment, we're creating a very simple web page that displays data we found through an open API. I chose to use the NY Times' API on the most emailed, shared, and viewed articles. You can check out my web page here (last updated on 2/6 at 3pm).
The URL that I used to retrieve this data (which returns JSON data) is:
http://api.nytimes.com/svc/mostpopular/v2/mostshared/all-sections/1/?api-key=[XXXXXXXX]
I haven't included my API key here for obvious reasons, but you would insert your own key in order to get the JSON data. The URL encodes the following elements:
- http://api.nytimes/com/svc - the base URI for the NY Times' API
- /mostpopular - the NY Times' "Most Popular" API, which accesses data for its most popular articles
- /v2 - the version of the API, currently version 2 (this would have to be updated whenever the API version changes)
- /mostshared - accesses the data of the "most shared" NY Times article (other options include most emailed and most viewed)
- /all-sections - indicates we're retrieving data from all of the NY Times' sections, rather than specifically targeting Business, or Sports, for example
- /1 - indicates the time period, which in this case, is just one day
The returned JSON data looks like this (for the first entry):