...
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.
Anchor | ||||
---|---|---|---|---|
|
...
Deleting a post
The following can be used to delete a post deletePost
operation deletes a post based on the specified post ID.
Code Block | ||||
---|---|---|---|---|
| ||||
<facebook.deletePost> <postId>{$ctx:postId}</postId> </facebook.deletePost> |
Properties Properties
postId
: The post ID- unique ID of the post that you want to delete.
Anchor | ||||
---|---|---|---|---|
|
...
request
Following is a sample REST request for the deletePost methodthat can be handled by the deletePost
operation.
Code Block | ||||
---|---|---|---|---|
| ||||
{ "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 /#deleting
Anchor | ||||
---|---|---|---|---|
|
...
Reading a post
This method will retrieve a post. It requires fields and connection parameters to be passed within initThe getPost
operation reads a particular post based on the specified fields.
Info | ||
---|---|---|
| ||
Before performing this operation, ensure that you call the |
Code Block | ||||
---|---|---|---|---|
| ||||
<facebook.getPost> <postId>{$ctx:postId}</postId> <fields>{$ctx:fields}</fields> </facebook.getPost> |
...
Properties
fields
: The fields which belongs to an objectof the post that you want to read. For more information on the fields property, see https://developers.facebook.com/docs/graph-api/reference/post.postId
: The post IDID of the post that you want to read.
Sample request
Following is a sample REST request for the getPost methodthat can be handled by the getPost
operation.
Code Block | ||||
---|---|---|---|---|
| ||||
{ "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
...
Following is a sample proxy service that illustrates how to connect to Facebook with the init operation the init
operation and then use the deletePost operation deletePost
operation. The sample request for this proxy can be found in in the deletePost
sample request . You can use this sample as a template for using other operations in this category.
Info |
---|
As a best practice, create create a separate sequence for handling the to handle response payload for errors. In the following sample, this sequence is "faultHandlerSeq"the sequence that handles errors is the |
Code Block | ||||
---|---|---|---|---|
| ||||
<?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> |
...