[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[fb-web] 11 Graph API Request

"Print a JavaScript Facebook Page, or inspect the error returned. Note: it is OK to return an authorization error here."
FB current
	api: '/113124472034820'
	callback: [:response|
		response#error isNil
		ifTrue:  [ self print: response ]
		ifFalse: [ UI8Inspector openOn: response#error ]
	]


"Print the last name of the current user."
FB current
	api: '/me' params: #fields -> #last_name
	callback: [:response|
		response#error isNil
		ifTrue:  [ self print: response ]
		ifFalse: [ UI8Inspector openOn: response#error ]
	]


"Publish a status message to the current user's feed."
| body |
body := 'Implementing FB SDK for Web in S8'.
FB current
	api: '/me/feed' method: #post
	params: #message -> body
	callback: [:response|
		response#error notNil ifTrue: [ self error: response#error#message ].
		self print: 'Post ID= ' ,response#id
	]


"Delete a previously published post."
| postId |
postId := #1234567890.
FB current
	api: '/' ,postId method: #delete
	callback: [:response|
		response#error notNil ifTrue: [ self error: response#error#message ].
		self print: 'Post ' ,postId ,' was deleted'
	]


"Reading a Page's messages using a Page Access Token."
| token result |
token := #1234567890|faketoken.
result := FB current
	api: '/me/conversations'
	params: #access_token -> token.
result isNil ifTrue: [
	self error: 'Canīt access conversations'
].
UI8Inspector openOn: result


Reference