Versions Compared

Key

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

...

  • postId: The unique ID of the post that you want to delete.

Anchor
request
request
Sample request

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

...

The getPost operation reads a particular post based on the specified fields.

Noteinfo
titleNote

This operation requires the following properties to be passed within <facebook.init>:

  • fields
  • connection

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>

...

Sample request

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

...

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. 

Info

As a best practice, create a separate sequence for handling the to handle response payload for errors. In the following sample, the sequence that handles errors is is the faultHandlerSeq.

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

...