Versions Compared

Key

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

...

Table of Contents
maxLevel3
typeflat

Overview

The following operations allow you to work with users. Click an operation name to see details on how to use it. 

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

OperationDescription
createPostAllows to create a post.
createUserAchievementAllows to create the achievements.
deleteUserAchievementAllows the user to delete the required achievement type.
getMutualFriendsAllows to retrieve the list of mutual friends between two people.
getUserDetailsAllows to retrieve the details of the user.
isFriendChecks if the person is a friend of the user.
publishNotificationAllows to publish the user's unread Facebook notifications.
publishPhotoAllows the user to upload photos.
sendAppRequestAllows the user to receive the requests from the app making the API call.

Operation details

This section provides details on each of the operations.

...

This method allows the users to publish a post. 

Code Block
languagehtml/xml
titlecreatePost
<facebook.createPost> 
	<message>{$ctx:message}</message> 
	<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> 
Properties
  • 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
titleSample Request for createPost
{
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"CAACEdEose0cBAELbf7L36EFqHJktqfWa75sOC92i0PiZC13cEmvL4wb2b6Oaz7m7V46QydCUVPTgE7Ouxu35RloyVcrdmFnpvkyp0CJZCR0oAGc1wZAP9yN4a49O53PkA7z8QG5mJNfvKggggG8Xdbgcl1w72NMZC7L7SIqht40bmW4iAaXhTkFUO0ybOkcZD",
"message":"This week is not over"
}

Further illustration on link, actions and privacy is given in https://developers.facebook.com/docs/graph-api/reference/user/feed/#readfields

Related Facebook documentation

https://developers.facebook.com/docs/graph-api/reference/user/feed/#publish  

...

 This will create the achievements of the user received from Facebook Games. 

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.    

...

Sample request

Following is a sample REST request for the createUserAchievement method.

Code Block
languagehtml/xml
titleSample Request for createUserAchievement
{
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"CAACEdEose0cBAGlDzIRGv0KAopxqBhmSKgQTbfvnROAZAwZBPSnH7OpqVeEP9t4eZCpO2xbIdIZAI4g6MayNwIgk3R7t4xqX2atZAKfxqJS8UnacJJjthuAsnr8eI7pyOuLojRtdzH2zNFdwt7K1QeJgH6isCYpAFg2ZBY6r3MqDssgTQ7fES5zCrPpopr3S29wAKiz089MgZDZD",
"achievement":"http://www.krishantha.com/fbtest.html"
}

Related Facebook documentation

https://developers.facebook.com/docs/graph-api/reference/user/achievements/#publish

...

The following will allow the user to delete the required achievement type.

Code Block
languagehtml/xml
titledeleteUserAchievement
<facebook.deleteUserAchievement>
	<achievement>{$ctx:achievement}</achievement>
</facebook.deleteUserAchievement>
 Properties
  • 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.

Code Block
languagehtml/xml
titleSample Request for deleteUserAchievement
{
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"CAACEdEose0cBAGlDzIRGv0KAopxqBhmSKgQTbfvnROAZAwZBPSnH7OpqVeEP9t4eZCpO2xbIdIZAI4g6MayNwIgk3R7t4xqX2atZAKfxqJS8UnacJJjthuAsnr8eI7pyOuLojRtdzH2zNFdwt7K1QeJgH6isCYpAFg2ZBY6r3MqDssgTQ7fES5zCrPpopr3S29wAKiz089MgZDZD",
"achievement":"http://www.krishantha.com/fbtest.html"
}

Related Facebook documentation:

https://developers.facebook.com/docs/graph-api/reference/user/achievements/#delete 

...

The following will display the list of mutual friends between two people.

Code Block
languagehtml/xml
titlegetMutualFriends
<facebook.getMutualFriends>
	<userAId>{$ctx:userAId}</userAId>
	<userBId>{$ctx:userBId}</userBId>
</facebook.getMutualFriends>
 Properties
  • 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
titleSample Request for getMutualFriends
{
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"CAACEdEose0cBAAAQrho1OkWWT1YUZAzbOkXYq8VZBacxr7a7sWh3KwLJL7WVkwLBFUXBWAIy3G59HpWx1FWIrbSIlf2tbO6TTB4c4RCk5WkR8Llyavcze7y1obrG86e0LZAMCZAvLiNxJ8Vb6b8HBTD0TL3WRLiZBXRhYDRFli5c2gxw73Xp8pZBcUsNue5eIZD",
"userAId":"747051343",
"userBId":"1732179422",
"fields":""
}

For further information on "fields", refer to https://developers.facebook.com/docs/graph-api/reference/user/mutualfriends#readfields.

Related Facebook documentation:

https://developers.facebook.com/docs/reference/api/video/#!/docs/graph-api/reference/user/mutualfriends

...

This method will retrieve details of the user. This requires the fields and connection parameters to be passed in init.

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

Following is a sample REST request for the getUserDetails method.

Code Block
languagehtml/xml
titleSample Request for getUserDetails
{
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"CAACEdEose0cBAPas3EqVsnzvtvEyZAPdrXEgdRRHEYEa6wZBJzupmqxJQXnxQ75EHeyg9cZBa2lOgObUpdmTTfQLqryHHjAV5bgd7njEML9uZBAaNuYl6q1KjlCteifZA9THGTRsZBZBk2LQQEaaHZCxQmUsYh3RMghs9vDGhOZC0Y8ZAdVpRl3usfCRvitQtLNHPNKOWzy59peAZDZD",
"fields":""
}

For further details on "fields", refer to https://developers.facebook.com/docs/graph-api/reference/user#fields

Related Facebook documentation

https://developers.facebook.com/docs/graph-api/reference/user#read

...

This method determines whether a person is friends with the root node user. This requires the fields parameter to be passed into init.

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. 
Sample request

Following is a sample REST request for the isFriend method.

Code Block
languagehtml/xml
titleSample Request for isFriend
{
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"CAACEdEose0cBAAAQrho1OkWWT1YUZAzbOkXYq8VZBacxr7a7sWh3KwLJL7WVkwLBFUXBWAIy3G59HpWx1FWIrbSIlf2tbO6TTB4c4RCk5WkR8Llyavcze7y1obrG86e0LZAMCZAvLiNxJ8Vb6b8HBTD0TL3WRLiZBXRhYDRFli5c2gxw73Xp8pZBcUsNue5eIZD",
"sourceUserId":"1732179422",
"targetUserId":"747051343",
"fields":""
}

Related Facebook documentation: 

https://developers.facebook.com/docs/graph-api/reference/user/friends/#read

...

Displays the user's unread Facebook notifications.

Code Block
languagehtml/xml
titlepublishNotification
<facebook.publishNotification>
	<href>{$ctx:href}</href>
	<userId>{$ctx:userId}</userId>
	<template>{$ctx:template}</template>
</facebook.publishNotification>

 Properties

  • href: The relative path that someone clicking on the notification will be directed to. This will be appended to the app's canvas URL.
  • userId: The ID of the person's user account.
  • template: The message text of the notification. This can be formatted according to special text templating. Maximum of 180 characters.

Sample request

Following is a sample REST request for the publishNotification method.

Code Block
languagehtml/xml
titleSample Request for publishNotification
{
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"CAAGZCMZA2ZCZBjIBAGggngSr83BQeKyZBURGscejHaGc8yI6524yDPv6lsamw2ua7Hmh13DT9YPTiM2hpJFXmXZBLlxeqtpSrmenGItIZAJmQNKkyUdnGwZACJaXu7Cyp0ZCiD4AViO5t1RTSzg8RWsVEad5mCsDfafzJ1tYYMQZARpDyMiZB3FQ4R3V7gs2j7j0igZD",
"userId":"142758138512",
"href":"id/team",
"template":"This is app is awsome"
}

Related Facebook documentation

https://developers.facebook.com/docs/graph-api/reference/user/notifications/#publish

...

Table of Contents
maxLevel3
typeflat

...

Overview

The following operations allow you to work with users. Click an operation name to see details on how to use it. 

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

OperationDescription
createPostAllows to create a post.
getMutualFriendsAllows to retrieve the list of mutual friends between two people.
getUserDetailsAllows to retrieve the details of the user.
isFriendChecks if the person is a friend of the user.
publishNotificationAllows to publish the user's unread Facebook notifications.

Operation details

This section provides details on each of the operations.

Anchor
createPost
createPost
Creating a post

This method allows the users to publish a post. 

Code Block
languagehtml/xml
titlecreatePost
<facebook.createPost> 
	<message>{$ctx:message}</message> 
	<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> 
Properties
  • 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
titlepublishPhoto
<facebook.publishPhoto>
	<userId>{$url:user_id}</userId>
	<apiUrl>https://graph.facebook.com</apiUrl>
	<apiVersion>{$url:apiVersion}</apiVersion>
	<accessToken>{$url:accessToken}</accessToken>
	<caption>{$url:caption}</caption>
	<photoUrl>{$url:photoUrl}</photoUrl>
	<targetId>{$url:targetId}</targetId>
	<tags>{$url:tags}</tags>
	<place>{$url:place}</place>
	<isExplicitPlace>{$url:isExplicitPlace}</isExplicitPlace>
	<isExplicitLocation>{$url:isExplicitLocation}</isExplicitLocation>
	<ogActionTypeId>{$url:ogActionTypeId}</ogActionTypeId>
	<ogObjectId>{$url:ogObjectId}</ogObjectId>
   	<ogPhrase>{$url:ogPhrase}</ogPhrase>
	<ogIconId>{$url:ogIconId}</ogIconId>
	<ogSuggestionMechanism>{$url:ogSuggestionMechanism}</ogSuggestionMechanism>
	<privacy>{$url:privacy}</privacy>
	<targeting>{$url:targeting}</targeting>
	<feedTargeting>{$url:feedTargeting}</feedTargeting>
	<noStory>{$url:noStory}</noStory>
	<published>{$url:published}</published>
	<offlineId>{$url:offlineId}</offlineId>
	<backdatedTime>{$url:backdatedTime}</backdatedTime>
   	<backdatedTimeGranularity>{$url:backdatedTimeGranularity}</backdatedTimeGranularity>
	<fullResIsComingLater>{$url:fullResIsComingLater}</fullResIsComingLater>
	<scheduledPublishTime>{$url:scheduledPublishTime}</scheduledPublishTime>
	<manualPrivacy>{$url:manualPrivacy}</manualPrivacy>
	<audienceExp>{$url:audienceExp}</audienceExp>
	<applicationId>{$url:applicationId}</applicationId>
</facebook.publishPhoto>

 Properties 

  • 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.

...

Sample Request for createPost
{
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"CAACEdEose0cBAELbf7L36EFqHJktqfWa75sOC92i0PiZC13cEmvL4wb2b6Oaz7m7V46QydCUVPTgE7Ouxu35RloyVcrdmFnpvkyp0CJZCR0oAGc1wZAP9yN4a49O53PkA7z8QG5mJNfvKggggG8Xdbgcl1w72NMZC7L7SIqht40bmW4iAaXhTkFUO0ybOkcZD",
"message":"This week is not over"
}

Further illustration on link, actions and privacy is given in https://developers.facebook.com/docs/graph-api/reference/user/feed/#readfields

Related Facebook documentation

https://developers.facebook.com/docs/graph-api/reference/user/feed/#publish  

Anchor
getMutualFriends
getMutualFriends
Retrieving mutual friends

The following will display the list of mutual friends  the session user and the request user have in common.

Code Block
languagehtml/xml
titlegetMutualFriends
<facebook.getMutualFriends>
	<userId>{$ctx:userId}</userId>
</facebook.getMutualFriends>
 Properties
  • 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
titleSample Request for getMutualFriends
{
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"CAACEdEose0cBAAAQrho1OkWWT1YUZAzbOkXYq8VZBacxr7a7sWh3KwLJL7WVkwLBFUXBWAIy3G59HpWx1FWIrbSIlf2tbO6TTB4c4RCk5WkR8Llyavcze7y1obrG86e0LZAMCZAvLiNxJ8Vb6b8HBTD0TL3WRLiZBXRhYDRFli5c2gxw73Xp8pZBcUsNue5eIZD",
"userId":"747051343",
"fields":""
}

For further information on "fields", refer to https://developers.facebook.com/docs/graph-api/reference/user/mutualfriends#readfields.

Related Facebook documentation:

https://developers.facebook.com/docs/reference/api/video/#!/docs/graph-api/reference/user/mutualfriends

Anchor
getUserDetails
getUserDetails
Retrieving user details

This method will retrieve details of the user. This requires the fields and connection parameters to be passed in init.

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

Following is a sample REST request for the getUserDetails method.

Code Block
languagehtml/xml
titleSample Request for getUserDetails
{
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"CAACEdEose0cBAPas3EqVsnzvtvEyZAPdrXEgdRRHEYEa6wZBJzupmqxJQXnxQ75EHeyg9cZBa2lOgObUpdmTTfQLqryHHjAV5bgd7njEML9uZBAaNuYl6q1KjlCteifZA9THGTRsZBZBk2LQQEaaHZCxQmUsYh3RMghs9vDGhOZC0Y8ZAdVpRl3usfCRvitQtLNHPNKOWzy59peAZDZD",
"fields":""
}

For further details on "fields", refer to https://developers.facebook.com/docs/graph-api/reference/user#fields

Related Facebook documentation

https://developers.facebook.com/docs/graph-api/reference/user#read

Anchor
isFriend
isFriend
Determining friends

This method determines whether a person is friends with the root node user. This requires the fields parameter to be passed into init.

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. 
Sample request

Following is a sample REST request for the isFriend method.

Code Block
languagehtml/xml
titleSample Request for publishPhotoisFriend
 curl -X POST \
     -d "source=%7Bimage-data%7D" \
         http://localhost:8280/services/facebook_publishPhoto?user_id={userId{
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"CAACEdEose0cBAAAQrho1OkWWT1YUZAzbOkXYq8VZBacxr7a7sWh3KwLJL7WVkwLBFUXBWAIy3G59HpWx1FWIrbSIlf2tbO6TTB4c4RCk5WkR8Llyavcze7y1obrG86e0LZAMCZAvLiNxJ8Vb6b8HBTD0TL3WRLiZBXRhYDRFli5c2gxw73Xp8pZBcUsNue5eIZD",
"sourceUserId":"1732179422",
"targetUserId":"747051343",
"fields":""
}

Related Facebook documentation: 

https://developers.facebook.com/docs/graph-api/reference/user/photosfriends/#publish#read

Anchor

...

Contains the requests received by the user from the app making the API call.

Code Block
languagehtml/xml
titlesendAppRequest
<facebook.sendAppRequest>
	<message>{$url:message}</message>
	<idsInvitable>{$url:idsInvitable}</idsInvitable>
	<actionType>{$url:actionType}</actionType>
	<data>{$url:data}</data>
	<objectId>{$url:objectId}</objectId>
	<ref>{$url:ref}</ref>
	<from>{$url:from}</from>
</facebook.sendAppRequest>

 Properties

...

publishNotification
publishNotification
Publishing notification

Displays the user's unread Facebook notifications.

Code Block
languagehtml/xml
titlepublishNotification
<facebook.publishNotification>
	<href>{$ctx:href}</href>
	<userId>{$ctx:userId}</userId>
	<template>{$ctx:template}</template>
</facebook.publishNotification>

 Properties

  • href: The relative path that someone clicking on the notification will be directed to. This will be appended to the app's canvas URL.
  • userId: The ID of the person's user account.
  • template: The message text of the notification. This can be formatted according to special text templating. Maximum of 180 characters.

Sample request

Following is a sample REST request for the sendAppRequest for the publishNotification method.

Code Block
languagehtml/xml
titleSample Request for sendAppRequestpublishNotification
{
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"CAAD8biEgxBIBAFppUAINka4ZCFYNaHLu5R7KHYeSfrwcQSpDLDoBUmsMEIkgjS2wuxGdCmYlD8LnlESKAlrskIibZBZBjEeyoEzRuF2cd3oSqoTSYKaju3jXyU4Q5HDhaJOFQMyxa39BaPm6G0MYXSWrVbOV8QyZAO5OfqyOWizQucIWHOe5K7JdXDZCWwh94e5RiteiSYAZDZDCAAGZCMZA2ZCZBjIBAGggngSr83BQeKyZBURGscejHaGc8yI6524yDPv6lsamw2ua7Hmh13DT9YPTiM2hpJFXmXZBLlxeqtpSrmenGItIZAJmQNKkyUdnGwZACJaXu7Cyp0ZCiD4AViO5t1RTSzg8RWsVEad5mCsDfafzJ1tYYMQZARpDyMiZB3FQ4R3V7gs2j7j0igZD",
"userId":"100007674122684142758138512",
"messagehref":"Test from soapui dulpeid/team",
"datatemplate":"This is app is awsome"
}

Related Facebook documentation: 

https://developers.facebook.com/docs/graph-api/reference/user/apprequestsnotifications/#publish

Anchor
sample
sample

Sample configuration

...