ウォールの情報にアクセスできます。
GET https://graph.facebook.com/ID/feed
パラメータを何も指定しない場合は、IDで指定したプロフィールのウォールに投稿されたメッセージを取得します。
feedのすべての情報にアクセスするには、read_streamの権限を取得している必要があります。
{
"data" : [{
"id" : "19292868552_10151863658935582",
"from" : {
"name" : "Facebook Platform",
"category" : "Product/service",
"id" : "19292868552"
},
"to" : {
"data" : [{
"name" : "Graph API Explorer",
"id" : "145634995501895"
}
]
},
"message" : "We continue our series looking at how to build Open Graph apps end-to-end. Yesterday, we looked at creating Action Types and Object Types and publishing Actions from the Graph API Explorer.\n\nToday, we'll look at how to publish actions using the Javascript SDK.",
"message_tags" : {
"170" : [{
"id" : "145634995501895",
"name" : "Graph API Explorer",
"type" : "application",
"offset" : 170,
"length" : 18
}
]
},
"picture" : "http://vthumb.ak.fbcdn.net/hvthumb-ak-ash3/574254_10151863663215582_10151863658935582_14588_1338_b.jpg",
"link" : "http://www.facebook.com/photo.php?v=10151863658935582",
"source" : "http://video.ak.fbcdn.net/cfs-ak-snc6/v/593790/557/10151863658935582_7396.mp4?oh=67427cfd390ca6e02d00869f4b5920c2&oe=4FFE2100&__gda__=1342054656_d69aa888548ed355d9b394b2a480cb97",
"name" : "Open Graph - 3: Publishing Actions from the Facebook JS SDK",
"properties" : [{
"name" : "Length",
"text" : "2:57"
}
],
"icon" : "http://static.ak.fbcdn.net/rsrc.php/v2/yD/r/DggDhA4z4tO.gif",
"actions" : [{
"name" : "Comment",
"link" : "http://www.facebook.com/19292868552/posts/10151863658935582"
}, {
"name" : "Like",
"link" : "http://www.facebook.com/19292868552/posts/10151863658935582"
}
],
"place" : {
"id" : "265781023507354",
"name" : "Facebook London",
"location" : {
"street" : "42 Earlham Street",
"city" : "London",
"country" : "United Kingdom",
"zip" : "WC2H 9LA",
"latitude" : 51.513855129521,
"longitude" : -0.12574267294645
}
},
"type" : "video",
"object_id" : "10151863658935582",
"application" : {
"name" : "Video",
"namespace" : "video",
"id" : "2392950137"
},
"created_time" : "2012-06-29T21:02:07+0000",
"updated_time" : "2012-06-29T21:02:07+0000",
"shares" : {
"count" : 37
},
"likes" : {
"data" : [{
"name" : "Morteza Yousefi",
"id" : "100003546555626"
}, {
"name" : "BegenkThea Returnithy",
"id" : "100002593281199"
}, {
"name" : "Vahid Farzad",
"id" : "1393612701"
}, {
"name" : "Cuong Bia",
"id" : "100003680262943"
}
],
"count" : 356
},
"comments" : {
"count" : 86
}
}, {
"id" : "19292868552_10151859850890582",
"from" : {
"name" : "Facebook Platform",
"category" : "Product/service",
"id" : "19292868552"
},
"message" : "Yesterday we looked at what Open Graph is, and why we built it - so lets get started. Today we'll build our first Open Graph app, creating our first object types and action types, and publishing our first action instance.",
"picture" : "http://vthumb.ak.fbcdn.net/hvthumb-ak-prn1/574108_10151859956645582_10151859850890582_19492_1070_b.jpg",
"link" : "http://www.facebook.com/photo.php?v=10151859850890582",
"source" : "http://video.ak.fbcdn.net/cfs-ak-snc7/v/435828/363/10151859850890582_46809.mp4?oh=5cc42fa51bb15ffdb06aac40f63288d7&oe=4FFE2100&__gda__=1342054656_f7f00dda12fd9ccb64b1ecfc4724ef3c",
"name" : "Open Graph - 2: Creating your first Actions and Objects",
"properties" : [{
"name" : "Length",
"text" : "12:47"
}
],
"icon" : "http://static.ak.fbcdn.net/rsrc.php/v2/yD/r/DggDhA4z4tO.gif",
"actions" : [{
"name" : "Comment",
"link" : "http://www.facebook.com/19292868552/posts/10151859850890582"
}, {
"name" : "Like",
"link" : "http://www.facebook.com/19292868552/posts/10151859850890582"
}
],
"place" : {
"id" : "265781023507354",
"name" : "Facebook London",
"location" : {
"street" : "42 Earlham Street",
"city" : "London",
"country" : "United Kingdom",
"zip" : "WC2H 9LA",
"latitude" : 51.513855129521,
"longitude" : -0.12574267294645
}
},
"type" : "video",
"object_id" : "10151859850890582",
"application" : {
"name" : "Video",
"namespace" : "video",
"id" : "2392950137"
},
"created_time" : "2012-06-28T16:51:46+0000",
"updated_time" : "2012-06-28T16:51:46+0000",
"shares" : {
"count" : 58
},
"likes" : {
"data" : [{
"name" : "Morteza Yousefi",
"id" : "100003546555626"
}, {
"name" : "Cuong Bia",
"id" : "100003680262943"
}, {
"name" : "Pengalaman Yg Paling Baru",
"id" : "100003602027880"
}, {
"name" : "Ridwan Allamsyah",
"id" : "100002547003178"
}
],
"count" : 312
},
"comments" : {
"count" : 43
}
}
],
"paging" : {
"previous" : "https://graph.facebook.com/19292868552/feed?value=1&redirect=1&access_token=XXXX&since=1341003727&__previous=1",
"next" : "https://graph.facebook.com/19292868552/feed?value=1&redirect=1&access_token=XXXX&until=1340902305"
}
}
commentsフィールドは、その投稿数が少数ならばその内容まで含まれますが、多数の場合には直近の1、2件しか返されません。すべてのコメントを取得するにはidフィールド (投稿ID) を用いてcommentsへリクエストします。
ID/feedに対してmessageパラメータを付加してPOSTでリクエストすることで、メッセージを投稿できます。投稿に成功した場合には、投稿のID (post ID) が返されます。
投稿にはpublish_streamの権限が必要です。
PHP SDKを使用するならば、
$params = array( 'message'=>'TEST' ); $response = $facebook->api( '/me/feed', 'POST', $params );
のようにします。
| パラメータ | 説明 |
|---|---|
| message | |
| picture | |
| link | |
| name | |
| caption | |
| description | |
| source | |
| place | |
| tags |
ID/feed/へリクエストするときのpictureパラメータに指定できるのは、アルバムの写真またはウォールへ直接投稿された写真へのリンクです。iphone - Post photo on user's wall using Facebook iOS SDK - Facebook Stack Overflow
写真を投稿にするには、Photoを使用します。
投稿ID (post ID) を指定して、
DELETE https://graph.facebook.com/Post_ID
のURLに対して、HTTPのDELETEリクエストをします。
削除に成功した場合には、trueとテキストで返されます。失敗のときには、{"error":"(#200) XX"}とJSON形式で返されます。
削除できるのは、そのアプリケーションが行った投稿のみです。他のアプリケーションによる投稿を削除しようとすると"(#200) This post wasn't created by the application"と返されます。