Versions Compared

Key

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

...

  • message: The main body of the post, otherwise called the status message. Either link or message must be supplied.  
  • link: The URL of a link to attach to the post. Either link or  message must be supplied. Additional fields associated with link are shown below.
    • picture: Determines the preview image associated with the link.   
    • name: Overwrites the title of the link preview.    
    • caption: Overwrites the caption under the title in the link preview.    
    • description: Overwrites the description in the link preview   
  • actions: The action links attached to the post. 
  • place: Page ID of a location associated with this post.    
  • tags: Comma-separated list of user IDs of people tagged in this post. You cannot specify this field without also specifying a place 
  • privacy: Determines the privacy settings of the post. If not supplied, this defaults to the privacy level granted to the app in the Login Dialog. This field cannot be used to set a more open privacy setting than the one granted.  
  • objectAttachment: Facebook ID for an existing picture in the person's photo albums to be used as the thumbnail image. The person must be the owner of the photo, and the photo cannot be part of a message attachment. 
        

...

Sample request

Following is a sample REST request for the createPost method.

...

Code Block
languagehtml/xml
titlecreateUserAchievement
<facebook.createUserAchievement>
	<achievement>{$ctx:achievement}</achievement>
</facebook.createUserAchievement>
 Properties 
  • achievement: Required - The unique URL of the type of achievement that the person will receive.    
Anchor
request
request
Sample request

Following is a sample REST request for the createUserAchievement method.

...

  • achievement: Required - The unique URL of the type of achievement you want to delete.     
Sample request

Following is a sample REST request for the deleteUserAchievement method.

...

  • userAId: The ID of this person's user account.  

  • userBId: The ID of the user's selected friend.  

Sample request

Following is a sample REST request for the getMutualFriends method.

...

Code Block
languagehtml/xml
titlegetUserDetails
 <facebook.getUserDetails/>
Sample request

Following is a sample REST request for the getUserDetails method.

...

Code Block
languagehtml/xml
titleisFriend
<facebook.isFriend>
	<sourceUserId>{$ctx:sourceUserId}</sourceUserId>
	<targetUserId>{$ctx:targetUserId}</targetUserId>
</facebook.isFriend>

 Properties 

  • sourceUserId: ID of the person to be determined.
  • targetUserId: ID of the user to be checked with. 

...

Anchor
publishPhoto
publishPhoto
Publishing photos

Allows the user to upload photos. This does not require init to be called before the operation. Refer to multipart processing for detailed information.

...

  • userId:The id of the user.
  • apiUrl:The api url.
  • apiVersion:Version of Facebook API.
  • accessToken:accessToken.
  • caption:The description of the photo.
  • photoUrl:The URL of a photo that is already uploaded to the Internet.
  • targetId:User id to post the photo to an object that's not the user in the access token.
  • tags:Tags on this photo.
  • place:Page ID of a place associated with the photo.
  • isExplicitPlace:If set to true, the tag is a place, not a person.
  • isExplicitLocation:Is this an explicit location or not.
  • ogActionTypeId:The Open Graph action type.
  • ogObjectId:The Open Graph object ID.
  • ogPhrase:The Open Graph phrase.
  • ogIconId:The Open Graph icon.
  • ogSuggestionMechanism:The Open Graph suggestion.
  • privacy:Determines the privacy settings of the photo.
  • targeting:Allows you to target posts to specific audiences.
  • feedTargeting:Object that controls news feed targeting for this post.
  • noStory:If set to true, this will suppress feed and timeline story.
  • published:Set to false if you don't want the photo to be published immediately.
  • offlineId:Offline ID.
  • backdatedTime:A user-specified creation time for this photo.
  • backdatedTimeGranularity:Granularity. Default value: none.
  • fullResIsComingLater:Full res is coming later.
  • composerSessionId:Composer session ID.
  • scheduledPublishTime:Time at which an unpublished post should be published.
  • manualPrivacy:Manual privacy.
  • audienceExp:Audience exp.
  • applicationId:iTunes App ID.
Sample request

Refer to the multipart processing section.

Following is a sample REST request for the publishPhoto method.

Code Block
languagehtml/xml
titleSample Request for publishPhoto
 curl -X POST \
     -d "source=%7Bimage-data%7D" \
         http://localhost:8280/services/facebook_publishPhoto?user_id={userId}

...

  • message:The request message.
  • idsInvitable:Friend IDs.
  • actionType:Action Type.
  • data:Additional data a developer may pass for tracking.
  • objectId:Object ID.
  • ref:Reference.
  • from:From.
Sample request

Following is a sample REST request for the sendAppRequest method.

...

Following is a sample proxy service that illustrates how to connect to Facebook with the init operation and use the createPost operation to the createUserAchievement operation to Users. The sample request for this proxy can be found in createPost in  createUserAchievement 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 response payload for errors. In the following sample, this sequence is "faultHandlerSeq".

...

Code Block
languagehtml/xml
titlecreateEvent
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="facebook_createPost"
	   transports="https,http"
	   statistics="disable"
	   trace="disable"
	   startOnLoad="true">
  <target>
    <inSequence onError="faultHandlerSeq">
      <property name="apiUrl"
				expression="json-eval($.apiUrl)"/>
      <property name="accessToken"
				expression="json-eval($.accessToken)"/>
      <property name="nameachievement"
				expression="json-eval($.nameachievement)"/>
	  <facebook.init>
            <property name="apiVersion"
				expression="json-eval($.apiVersion)"/>
	  <facebook.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
			<apiVersion>{$url:apiVersion}</apiVersion>
            <accessToken>{$ctx:accessToken}</accessToken>
      </facebook.init>      
	  <facebook.createPost>createUserAchievement>
	  		   <message><achievement>{$ctx:messageachievement}</message> 
 		 achievement>
 <link>{$ctx:link}</link>  		   <picture>{$ctx:picture}</picture>
 		   <name>{$ctx:name}</name>
 		   <caption>{$ctx:caption}</caption>
 		   <description>{$ctx:description}</description>
 		   <actions>{$ctx:actions}</actions> 
 		   <place>{$ctx:place}</place> 
 		   <tags>{$ctx:tags}</tags> 
 		   <privacy>{$ctx:privacy}</privacy> 
 		   <objectAttachment>{$ctx:objectAttachment}</objectAttachment> 
	 </facebook.createPost></facebook.createUserAchievement>
	  <respond/>
    </inSequence>
    <outSequence>
      <property name="messageType" value="application/json" scope="axis2" />
      <send/>
    </outSequence>
  </target>
</proxy>