APIs
Application Program Interfaces are a set of rules dictating how applications should interact. When discussing APIs in the contet of the web, we are usually referring to the process we use to post information to a website or database or pull information from a website or database.
JSON
JavaScript Object Notation is a data format used extensively on the web. It was developed for easy parsing within JavaScipt.
- JSON is written in name|value pairs
"name":"Jake"
- Array:
1 2 3 4 |
{ "employees":[ "John", "Anna", "Peter" ] } |
- Objects can have several sub-object:
1 2 3 4 |
{ "employee":{ "name":"John", "age":30, "city":"New York" } } |
- An object with objects and an array:
1 2 3 4 5 6 7 |
{ "name":"jake", "age" : 34, "friends" [ "jim", "eric", "katie"], "day" : "wed" } |
Example JSON
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
{ created_at: 'Wed Feb 08 21:37:22 +0000 2017', id: 829444033101586400, id_str: '829444033101586440', text: 'In a Rare Zoo Escape, Sunny the Red Panda Is Still at Large https://t.co/mhOT4z8NIu https://t.co/8vHtTlqbmQ', display_text_range: [ 0, 83 ], source: '<a href="http://publicize.wp.com/" rel="nofollow">WordPress.com</a>', user: { id: 972385555, id_str: '972385555', name: 'Walkileaks', screen_name: 'walkileaks', location: 'United States', url: 'http://www.walkileaks.com', protected: false, utc_offset: -28800, is_translator: false, notifications: null }, geo: null, coordinates: null, place: null, contributors: null, is_quote_status: false, retweet_count: 0, favorite_count: 0, entities: { hashtags: [], urls: [ [Object] ], user_mentions: [], symbols: [], media: [ [Object] ] }, extended_entities: { media: [ [Object] ] }, timestamp_ms: '1486589842473' } |