586
edits
| (16 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| =API – Application Programming Interface= | =API – Application Programming Interface= | ||
| [http://www.slideshare.net/augentier/api-vortrag Präsentation auf slideshare.net] | |||
| ==Übersicht== | ==Übersicht== | ||
| * Facebook – Graph API | * Facebook – Graph API | ||
| Line 5: | Line 6: | ||
| * YouTube – Data API | * YouTube – Data API | ||
| ==[[JSON]]== | ==[[JSON]]== | ||
| ===Struktur  | ===Struktur von JSON=== | ||
| <source lang="javascript" > | <source lang="javascript" > | ||
| { | { | ||
| Line 19: | Line 20: | ||
| } | } | ||
| </source> | </source> | ||
| '' | ''Size: 169 Bytes'' | ||
| ===Vergleich zu XML=== | ===Vergleich zu XML=== | ||
| <source lang="xml"> | <source lang="xml"> | ||
| Line 34: | Line 36: | ||
| </object> | </object> | ||
| </source> | </source> | ||
| '' | ''Size: 226 Bytes'' | ||
| ===Vorteile gegenüber XML=== | |||
| Kleinere Datei, verschiedene Daten-Typen (string, number, object, array, boolean, empty), einfaches Parsing in JavaScript, PHP, Objective-C usw. | |||
| ==Parsing JSON== | ==Parsing JSON== | ||
| ===jQuery=== | ===jQuery=== | ||
| Line 76: | Line 79: | ||
| } | } | ||
| </source> | </source> | ||
| '' | ''Size: 1.16 KB'' | ||
| ===Albums=== | ===Albums=== | ||
| [http://graph.facebook.com/mercedesbenzdeutschland/albums graph.facebook.com/mercedesbenzdeutschland/albums] | [http://graph.facebook.com/mercedesbenzdeutschland/albums graph.facebook.com/mercedesbenzdeutschland/albums] | ||
| Line 120: | Line 123: | ||
| } | } | ||
| </source> | </source> | ||
| '' | ''Size: 1.16 KB'' | ||
| ===Album Photos=== | ===Album Photos=== | ||
| Line 154: | Line 157: | ||
| 					"height": 505, | 					"height": 505, | ||
| 					"width": 720, | 					"width": 720, | ||
| 					"source": "http://a6.sphotos.ak.fbcdn.net/hphotos-ak-snc7/s720x720/ | 					"source": "http://a6.sphotos.ak.fbcdn.net/hphotos-ak-snc7/s720x720/299511_2510922149…" | ||
| 				}, | 				}, | ||
| 				{ | 				{ | ||
| 					"height": 126, | 					"height": 126, | ||
| 					"width": 180, | 					"width": 180, | ||
| 					"source": "http://photos-f.ak.fbcdn.net/hphotos-ak-snc7/ | 					"source": "http://photos-f.ak.fbcdn.net/hphotos-ak-snc7/299511_251092214938743_14568965…" | ||
| 				}, | 				}, | ||
| 				[…] | |||
| 			], | 			], | ||
| 			"link": "http://www.facebook.com/photo.php?pid=642955&id=145689658812333", | 			"link": "http://www.facebook.com/photo.php?pid=642955&id=145689658812333", | ||
| Line 207: | Line 201: | ||
| 			"height": 126, | 			"height": 126, | ||
| 			"width": 180, | 			"width": 180, | ||
| 			"source": "http://photos-f.ak.fbcdn.net/hphotos-ak-snc7/ | 			"source": "http://photos-f.ak.fbcdn.net/hphotos-ak-snc7/299511_251092214938743_145689658812333_642955…" | ||
| 		}, | 		}, | ||
| 		[…] | 		[…] | ||
| Line 217: | Line 211: | ||
| ===Reference=== | ===Reference=== | ||
| [http://developers.facebook.com/docs/reference/api/ developers.facebook.com/docs/reference/api/] | [http://developers.facebook.com/docs/reference/api/ developers.facebook.com/docs/reference/api/] | ||
| ===Example=== | |||
| [[File:Example_facebook_api.zip|Download Example]] | |||
| ==Twitter== | ==Twitter== | ||
| [http://api.twitter.com/1/statuses/user_timeline.json?screen_name=saschalobo api.twitter.com/1/statuses/user_timeline.json?screen_name=saschalobo] | [http://api.twitter.com/1/statuses/user_timeline.json?screen_name=saschalobo api.twitter.com/1/statuses/user_timeline.json?screen_name=saschalobo] | ||
| Line 223: | Line 220: | ||
| 	{ | 	{ | ||
| 		"id": 134979869225402368, | 		"id": 134979869225402368, | ||
| 		"text": "Keine Ahnung, was das f\u00fcr die Finanzkrise hiesse, aber mein Leben w\u00e4re besser, wenn der  | 		"text": "Keine Ahnung, was das f\u00fcr die Finanzkrise hiesse, aber mein Leben w\u00e4re besser, wenn der […]", | ||
| 		"created_at": "Fri Nov 11 13:04:43 +0000 2011", | 		"created_at": "Fri Nov 11 13:04:43 +0000 2011", | ||
| 		"user": { | 		"user": { | ||
| Line 234: | Line 231: | ||
| 	{ | 	{ | ||
| 		"id": 134944048069869569, | 		"id": 134944048069869569, | ||
| 		"text": "\u00dcberall liest man 11.11.11 \u2013\u00a0liebe Nerds, bitte achtet auch im Internet auf Eure  | 		"text": "\u00dcberall liest man 11.11.11 \u2013\u00a0liebe Nerds, bitte achtet auch im Internet auf Eure […]", | ||
| 		"created_at": "Thu Nov 10 22:31:56 +0000 2011", | 		"created_at": "Thu Nov 10 22:31:56 +0000 2011", | ||
| 		"user": { | 		"user": { | ||
| Line 247: | Line 244: | ||
| ===Reference=== | ===Reference=== | ||
| [http://dev.twitter.com/docs/api dev.twitter.com/docs/api] | [http://dev.twitter.com/docs/api dev.twitter.com/docs/api] | ||
| ==YouTube== | ==YouTube== | ||
| [http://gdata.youtube.com/feeds/api/users/NationalGeographic/uploads?v=2&alt=json&max-results=50 gdata.youtube.com/feeds/api/users/NationalGeographic/uploads?v=2&alt=json&max-results=50] | [http://gdata.youtube.com/feeds/api/users/NationalGeographic/uploads?v=2&alt=json&max-results=50 gdata.youtube.com/feeds/api/users/NationalGeographic/uploads?v=2&alt=json&max-results=50] | ||
| Line 281: | Line 279: | ||
| ===Reference=== | ===Reference=== | ||
| [http://code.google.com/intl/en-UK/apis/youtube/2.0/reference.html code.google.com/intl/en-UK/apis/youtube/2.0/reference.html] | [http://code.google.com/intl/en-UK/apis/youtube/2.0/reference.html code.google.com/intl/en-UK/apis/youtube/2.0/reference.html] | ||
| ===Example=== | |||
| [[File:Example_youtube_api.zip|Download Example]] | |||
edits