Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For a sample proxy service that illustrates how to work with posts, see Sample configuration.

OperationDescription
deletePost
Allows to delete
Deletes a post.
getPost
Allows to retrieve
Reads a specific post.

Operation details

This section provides details on each of the operations.

Anchor
deletePost
deletePost

...

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
languagehtml/xml
titledeletePost
<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
request
Sample

...

request

Following is a sample REST request for the deletePost methodthat can be handled by the deletePost operation.

Code Block
languagehtml/xml
titleSample Request for deletePost
{
"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
getPost
getPost

...

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
titleNote

Before performing this operation, ensure that you call the init operation with the fields and connection properties.

Code Block
languagehtml/xml
titlegetPost
<facebook.getPost>
	<postId>{$ctx:postId}</postId>
    <fields>{$ctx:fields}</fields>
</facebook.getPost>

...

 Properties

Sample request

Following is a sample REST request for the getPost methodthat can be handled by the getPost operation.

Code Block
languagehtml/xml
titleSample Request for getPost
{
"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 faultHandlerSeq.

Code Block
languagehtml/xml
titledeletePost
<?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>

...