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 | Deletes a post. |
getPost | Reads a specific post. |
Operation details
This section provides details on each of the operations.
Deleting a post
The deletePost
operation deletes a post based on the specified post ID.
<facebook.deletePost> <postId>{$ctx:postId}</postId> </facebook.deletePost>
Properties
postId
: The unique ID of the post.
Sample request
Following is a sample REST request that can be handled by the deletePost
operation.
{ "apiUrl":"https://graph.facebook.com", "apiVersion":"v2.4", "accessToken":"CAACEdEose0cBAPuaSDZA6AKhcpvdW8N5IX6W4MGY2K6eoBs7HGI5ltnY8Mo3DzfbmOtj9JBEqg87OhxONrwLcYA4ZCdel06Gjx8eSGI4Ek81NljIuzkOCPdIoaTG21WIZA1twlWZC1Jhx1uZAsROVNsiJmAjVGjqkQYePuh0RN9q6hZCxJX0QGitqEBKI0BT0ZD", "postId":"437870939677817_438355122962732" }
Related Facebook documentation:
https://developers.facebook.com/docs/graph-api/reference/post/#deleting
Reading a post
The getPost
operation reads a particular post based on the specified fields.
Note
This operation requires the following properties to be passed within <facebook.init>
:
- fields
- connection
<facebook.getPost> <postId>{$ctx:postId}</postId> <fields>{$ctx:fields}</fields> </facebook.getPost>
Properties
fields
: The post's fields that you want to read.Note
For more information on the
fields
property, see https://developers.facebook.com/docs/graph-api/reference/post
postId
: The post ID.
Sample request
Following is a sample REST request that can be handled by the getPost
operation.
{ "apiUrl":"https://graph.facebook.com", "apiVersion":"v2.4", "accessToken":"CAACEdEose0cBAECSQnQHnvaB8YntoMSxsnN84PUiQytGdDvnMARRUdDt5ywhVRJCcGfm8GfjDb4Py8wpEu4rZCSvZAx4X2aqdrzuIHQYM3zZBMmp1ZClHKtB5PXZBLaVowUuzKtSg1aa8zpaD6xhaxm9HxUdigNNX9zSWzpb3KZCZC24IYZCIx9MRx69mMMPu9KnlCrwZAhskswZDZD", "postId":"100007674122684_1401320516800406", "connection":"", "fields":"actions" }
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 then use the deletePost
operation. The sample request for this proxy can be found in the 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, the sequence that handles errors is faultHandlerSeq
.
<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>