Overview
The following operations allow you to work with posts. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with posts, see Sample configuration.
Operation | Description |
---|---|
deletePost | Allows to delete a post. |
getPost | Allows to retrieve a post. |
Operation details
This section provides details on each of the operations.
Removing post
The following can be used to delete a post.
<facebook.deletePost> <postId>{$ctx:postId}</postId> </facebook.deletePost>
Properties
- postId: The post ID.
Sample request
Following is a sample REST request for the deletePost method.
{ "apiUrl":"https://graph.facebook.com", "apiVersion":"v2.4", "accessToken":"CAACEdEose0cBAPuaSDZA6AKhcpvdW8N5IX6W4MGY2K6eoBs7HGI5ltnY8Mo3DzfbmOtj9JBEqg87OhxONrwLcYA4ZCdel06Gjx8eSGI4Ek81NljIuzkOCPdIoaTG21WIZA1twlWZC1Jhx1uZAsROVNsiJmAjVGjqkQYePuh0RN9q6hZCxJX0QGitqEBKI0BT0ZD", "postId":"437870939677817_438355122962732" }
Related Facebook documentation:
https://developers.facebook.com/docs/reference/api/video/#!/docs/graph-api/reference/post
Retrieving post
This method will retrieve a post. It requires fields and connection parameters to be passed within init.
<facebook.getPost> <postId>{$ctx:postId}</postId> <fields>{$ctx:fields}</fields> </facebook.getPost>
Properties
fields: The fields which belongs to an object
postId: The post ID.
Sample request
Following is a sample REST request for the getPost method.
{ "apiUrl":"https://graph.facebook.com", "apiVersion":"v2.4", "accessToken":"CAACEdEose0cBAECSQnQHnvaB8YntoMSxsnN84PUiQytGdDvnMARRUdDt5ywhVRJCcGfm8GfjDb4Py8wpEu4rZCSvZAx4X2aqdrzuIHQYM3zZBMmp1ZClHKtB5PXZBLaVowUuzKtSg1aa8zpaD6xhaxm9HxUdigNNX9zSWzpb3KZCZC24IYZCIx9MRx69mMMPu9KnlCrwZAhskswZDZD", "postId":"100007674122684_1401320516800406", "connection":"", "fields":"actions" }
Further illustration on "fields" is given in https://developers.facebook.com/docs/graph-api/reference/post
Related Facebook documentation:
https://developers.facebook.com/docs/graph-api/reference/post#read
Sample configuration
Following is a sample proxy service that illustrates how to connect to Facebook with the init operation and use the deletePost operation. The sample request for this proxy can be found in deletePost sample request. You can use this sample as a template for using other operations in this category.
As a best practice, create a separate sequence for handling the response payload for errors. In the following sample, this sequence is "faultHandlerSeq".
<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="facebook_deletePost" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence onError="faultHandlerSeq"> <property name="apiUrl" expression="json-eval($.apiUrl)"/> <property name="apiVersion" expression="json-eval($.apiVersion)"/> <property name="accessToken" expression="json-eval($.accessToken)"/> <property name="postId" expression="json-eval($.postId)"/> <facebook.init> <apiUrl>{$ctx:apiUrl}</apiUrl> <apiVersion>{$ctx:apiVersion}</apiVersion> <accessToken>{$ctx:accessToken}</accessToken> </facebook.init> <facebook.deletePost> <postId>{$ctx:postId}</postId> </facebook.deletePost> <respond/> </inSequence> <outSequence> <property name="messageType" value="application/json" scope="axis2"/> <send/> </outSequence> </target> <description/> </proxy>