This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Working with Applications in Facebook
Overview
The following operations allow you to work with applications. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with applications, see Sample configuration.
Operation | Description |
---|---|
banAppUser | Bans one or more users from using an application. |
createAppAchievements | Creates an achievement type in an application. |
createAppUserRole | Adds a user to a user role in an application. |
deleteAppAchievements | Deletes an achievement type from an application. |
getAppDetails | Returns details of a particular application. |
isAppUserBanned | Checks whether a specific user is banned from using a specified application. |
unbanAppUser | Unbans one or more users who are banned from using a particular application. |
updateAppDetails | Updates details of a particular application. |
Operation details
This section provides details on each of the operations.
Banning users from using an application
The banAppUser
operation bans one or more users from using a particular application.
<facebook.banAppUser> <appId>{$ctx:appId}</appId> <uids>{$ctx:uids}</uids> </facebook.banAppUser>
Properties
appId
: The unique identifier of the application that you want to ban.uids
: The user IDs of the users you want to ban from using the application.
Sample request
Following is a sample REST request that can be handled by the banAppUser
operation.
{ "apiUrl":"https://graph.facebook.com", "apiVersion":"v2.4", "accessToken":"277549932397586|OcXfD2DJscrv7ZZjNuQd6ne8kRA", "appId":"277549932397586", "uids":"1427581385" }
Related Facebook documentation:
https://developers.facebook.com/docs/graph-api/reference/app/banned#publish
Creating an achievement type
The createAppAchievements
operation creates an achievement type in an application. This operation requires a callback URL configuration. For more information, see https://developers.facebook.com/docs/games/services/scores-achievements#achievements.
<facebook.createAppAchievements> <achievement>{$ctx:achievement}</achievement> <appId>{$ctx:appId}</appId> <displayOrder>{$ctx:displayOrder}</displayOrder> </facebook.createAppAchievements>
Properties
achievement
: Required: The URL of an Open Graph achievement object. This URL should contain the tags required to describe an achievement object.appId
: The ID of the application in which you want to create an an achievement type.displayOrder
: The display order of the achievement when it is listed in an achievement stories UI. An order of 100 is displayed in the UI before 200. Values are unique and incremented in the correct order of the achievements.
Sample request
Following is a sample REST request that can be handled by the createAppAchievements
operation.
{ "apiUrl":"https://graph.facebook.com", "apiVersion":"v2.4", "accessToken":"CAACEdEose0cBAGlDzIRGv0KAopxqBhmSKgQTbfvnROAZAwZBPSnH7OpqVeEP9t4eZCpO2xbIdIZAI4g6MayNwIgk3R7t4xqX2atZAKfxqJS8 UnacJJjthuAsnr8eI7pyOuLojRtdzH2zNFdwt7K1QeJgH6isCYpAFg2ZBY6r3MqDssgTQ7fES5zCrPpopr3S29wAKiz089MgZDZD", "appId":"491694797617714", "achievement":"http://www.connector.com/test/fbtest.html", "displayOrder":"1" }
Related Facebook documentation:
https://developers.facebook.com/docs/graph-api/reference/app/achievements#publish
Adding a user to a role
The createAppUserRole
operation adds a specific user to a role in a specified application.
<facebook.createAppUserRole> <appId>{$ctx:appId}</appId> <role>{$ctx:role}</role> <user>{$ctx:user}</user> </facebook.createAppUserRole>
Properties
appId
: The ID of the application to which you want to add a user.role
: The name of the role that you want to assign to the user. Possible values areadministrators
,developers
,testers
, andinsights users
.user
: The ID of the user to assign the role.
Sample request
Following is a sample REST request that can be handled by the createAppUserRole
operation.
{ "apiUrl":"https://graph.facebook.com", "apiVersion":"v2.4", "accessToken":"CAAD8biEgxBIBAMLB5KY2QQvlPiB4mBd2yk72zLLPsAiJjIUrQxBzWgvS3HnCsrJm7KgNUaakL1usQPN365qNWHP9FHmpgj6RtSsIxfG6RUEbymB3sgNgTTuviPDpISpxIMf5eR3qSAofkdTHfzVUfGtAG8AJhDcX5v72SeQUynXbWnbFZAU5ZAECJuA9pSwp6GWTq5CwZDZD", "appId":"277549932397586", "role":"developers", "userId":"521458813" }
Related Facebook documentation:
https://developers.facebook.com/docs/graph-api/reference/app/roles#publish
Deleting an achievement type
The deleteAppAchievements
operation deletes an achievement type from an application.
<facebook.deleteAppAchievements> <achievement>{$ctx:achievement}</achievement> <appId>{$ctx:appId}</appId> </facebook.deleteAppAchievements>
Properties
achievement
: Required - The URL of an open graph achievement object. This URL should contain all the tags that describe the achievement object you want to delete.appId
: The ID of the application from which you want to delete an achievement type.
Sample request
Following is a sample REST request that can be handled by the deleteAppAchievements
operation.
{ "apiUrl":"https://graph.facebook.com", "apiVersion":"v2.4", "accessToken":"CAACEdEose0cBAGlDzIRGv0KAopxqBhmSKgQTbfvnROAZAwZBPSnH7OpqVeEP9t4eZCpO2xbIdIZAI4g6MayNwIgk3R7t4xqX2atZAKfxqJS8UnacJJjthuAsnr8eI7pyOuLojRtdzH2zNFdwt7K1QeJgH6isCYpAFg2ZBY6r3MqDssgTQ7fES5zCrPpopr3S29wAKiz089MgZDZD", "appId":"277549932397586", "achievement":"http://www.connector.com/test/fbtest.html" }
Related Facebook documentation:
https://developers.facebook.com/docs/graph-api/reference/app/achievements#delete
Removing a user from a user role
The deleteAppUserRole
operation removes a user from an assigned user role.
Note
Before performing this operation, ensure that you call the init
operation with the connection
properties.
<facebook.deleteAppUserRole> <appId>{$ctx:appId}</appId> <user>{$ctx:user}</user> </facebook.deleteAppUserRole>
Properties
appId
: The ID of the application.user
: The unique identifier of the user that you want to remove from the assigned role.
Sample request
Following is a sample REST request that can be handled by the deleteAppUserRole
operation.
{ "apiUrl":"https://graph.facebook.com", "apiVersion":"v2.4", "accessToken":"CAAD8biEgxBIBAMLB5KY2QQvlPiB4mBd2yk72zLLPsAiJjIUrQxBzWgvS3HnCsrJm7KgNUaakL1usQPN365qNWHP9FHmpgj6RtSsIxfG6RUEbymB3sgNgTTuviPDpISpxIMf5eR3qSAofkdTHfzVUfGtAG8AJhDcX5v72SeQUynXbWnbFZAU5ZAECJuA9pSwp6GWTq5CwZDZD", "appId":"277549932397586", "user":"521458813" }
Related Facebook documentation:
https://developers.facebook.com/docs/graph-api/reference/app/roles#delete
Retrieving details of an application
The getAppDetails
operation returns details of a specified application.
Note
Before performing this operation, ensure that you call the init
operation with the fields
and connection
properties.
<facebook.getAppDetails> <appId>{$ctx:appId}</appId> <connection>{$ctx:connection}</connection> <fields>{$ctx:fields}</fields> </facebook.getAppDetails>
Properties
appId
: The ID of the application for which you want to retrieve details.fields
: The fields that you want to retrieve. For more information on the fields property, see https://developers.facebook.com/docs/graph-api/reference/app#readfields.
Sample request
Following is a sample REST request that can be handled by the getAppDetails
operation.
{ "apiUrl":"https://graph.facebook.com", "apiVersion":"v2.4", "accessToken":"CAACEdEose0cBAECSQnQHnvaB8YntoMSxsnN84PUiQytGdDvnMARRUdDt5ywhVRJCcGfm8GfjDb4Py8wpEu4rZCSvZAx4X2aqdrzuIHQYM3zZBMmp1ZClHKtB5PXZBLaVowUuzKtSg1aa8zpaD6xhaxm9HxUdigNNX9zSWzpb3KZCZC24IYZCIx9MRx69mMMPu9KnlCrwZAhskswZDZD", "appId":"100007674122684_1401320516800406", "connection":"", "fields":"actions" }
Related Facebook documentation:
https://developers.facebook.com/docs/graph-api/reference/app#read
Checking whether a user is banned from using an application
The isAppUserBanned
operation checks whether a specific user is banned from using a specified application.
<facebook.isAppUserBanned> <appId>{$ctx:appId}</appId> <userId>{$ctx:uid}</userId> </facebook.isAppUserBanned>
Properties
appId
: The ID of the application that you want to check.userId
: The ID of the user you want to check.
Sample request
Following is a sample REST request that can be handled by the isAppUserBanned
operation.
{ "apiUrl":"https://graph.facebook.com", "apiVersion":"v2.4", "accessToken":"277549932397586|OcXfD2DJscrv7ZZjNuQd6ne8kRA", "appId":"277549932397586", "uid":"1427581385" }
Related Facebook documentation:
https://developers.facebook.com/docs/graph-api/reference/app/banned#read
Unbanning users who a banned from using an application
The unbanAppUser
operation unbans one or more banned users from using a specified application.
<facebook.unbanAppUser> <appId>{$ctx:appId}</appId> <uid>{$ctx:uid}</uid> </facebook.unbanAppUser>
Properties
appId
: The ID of the application from which the users are banned.uids
: The list of user IDs of users you want to unban.
Sample request
Following is a sample REST request that can be handled by the unbanAppUser
operation.
{ "apiUrl":"https://graph.facebook.com", "apiVersion":"v2.4", "accessToken":"277549932397586|OcXfD2DJscrv7ZZjNuQd6ne8kRA", "appId":"277549932397586", "uid":"1427581385" }
Related Facebook documentation:
https://developers.facebook.com/docs/graph-api/reference/app/banned#delete
Updating application details
The updateAppDetails
operation updates specified details of a specific application.
<facebook.updateAppDetails> <appId>{$ctx:appId}</appId> <appDomains>{$ctx:appDomains}</appDomains> <authDialogDataHelpUrl>{$ctx:authDialogDataHelpUrl}</authDialogDataHelpUrl> <authDialogHeadline>{$ctx:authDialogHeadline}</authDialogHeadline> <authDialogPermsExplanation>{$ctx:authDialogPermsExplanation}</authDialogPermsExplanation> <authReferralDefaultActivityPrivacy>{$ctx:authReferralDefaultActivityPrivacy}</authReferralDefaultActivityPrivacy> <authReferralEnabled>{$ctx:authReferralEnabled}</authReferralEnabled> <authReferralExtendedPerms>{$ctx:authReferralExtendedPerms}</authReferralExtendedPerms> <authReferralFriendPerms>{$ctx:authReferralFriendPerms}</authReferralFriendPerms> <authReferralUserPerms>{$ctx:authReferralUserPerms}</authReferralUserPerms> <authReferralResponseType>{$ctx:authReferralResponseType}</authReferralResponseType> <canvasFluidHeight>{$ctx:canvasFluidHeight}</canvasFluidHeight> <canvasFluidWidth>{$ctx:canvasFluidWidth}</canvasFluidWidth> <canvasUrl>{$ctx:canvasUrl}</canvasUrl> <contactEmail>{$ctx:contactEmail}</contactEmail> <deauthCallbackUrl>{$ctx:deauthCallbackUrl}</deauthCallbackUrl> <migrations>{$ctx:migrations}</migrations> <mobileWebUrl>{$ctx:mobileWebUrl}</mobileWebUrl> <namespace>{$ctx:namespace}</namespace> <pageTabDefaultName>{$ctx:pageTabDefaultName}</pageTabDefaultName> <pageTabUrl>{$ctx:pageTabUrl}</pageTabUrl> <privacyPolicyUrl>{$ctx:privacyPolicyUrl}</privacyPolicyUrl> <restrictions>{$ctx:restrictions}</restrictions> <secureCanvasUrl>{$ctx:secureCanvasUrl}</secureCanvasUrl> <securePageTabUrl>{$ctx:securePageTabUrl}</securePageTabUrl> <serverIpWhitelist>{$ctx:serverIpWhitelist}</serverIpWhitelist> <socialDiscovery>{$ctx:socialDiscovery}</socialDiscovery> <termsOfServiceUrl>{$ctx:termsOfServiceUrl}</termsOfServiceUrl> <userSupportEmail>{$ctx:userSupportEmail}</userSupportEmail> <userSupportUrl>{$ctx:userSupportUrl}</userSupportUrl> <websiteUrl>{$ctx:websiteUrl}</websiteUrl> </facebook.updateAppDetails>
Properties
appId
: The ID of the application you want to update.appDomains
: The domains and sub-domains that could be used by this application.authDialogDataHelpUrl
: The URL of a special landing page that helps users of the application to begin publishing Open Graph activity.authDialogHeadline
: A single line description of the application that appears in the login dialog.authDialogPermsExplanation
: The text that describes why the application requires additional permission, and why it appears in the Login dialog.authReferralDefaultActivityPrivacy
: The default privacy setting selected for Open Graph activities in the Login dialog.authReferralEnabled
: Indicates whether authenticated referrals are enabled.authReferralExtendedPerms
: Extended permission that a user can choose to grant when authenticated referrals are enabled.authReferralFriendPerms
: Basic friend permission that a user must grant when authenticated referrals are enabled.authReferralUserPerms
: Basic user permission that a user must grant when authenticated referrals are enabled.authReferralResponseType
: The format in which the application receives the auth token from the Login dialog.appName
: The application name.appType
: The application type.canvasFluidHeight
: Indicates whether the application uses fluid or settable height values for the canvas.canvasFluidWidth
: Indicates whether the application uses fluid or settable width values for the canvas.category
: The category of the application.canvasUrl
: The non-secure URL from which the canvas application content is loaded.configuredIosSso
: Indicates whether SSO on iOS is enabled for this application.contactEmail
: The ist of email addresses for users to contact developers.createdTime
: The timestamp that indicates when the application was created.deauthCallbackUrl
: The URL that is pinged whenever a user removes the application.iphoneAppStoreId
: The ID of this application in the iPhone app store.migrations
: Migration settings for this application.mobileWebUrl
: The URL to which mobile users will be directed when using the application.namespace
: The namespace for the application.pageTabDefaultName
: The title of the application when used in a page tab.pageTabUrl
: The non-secure URL from which the page tab application content is loaded.privacyPolicyUrl
: The URL that links to a privacy policy for the application.restrictions
: Demographic restrictions set for the application.secureCanvasUrl
: The secure URL from which canvas application content is loaded.securePageTabUrl
: The secure URL from which page tab application content is loaded.serverIpWhitelist
: A comma-separated list of IP addresses from which application requests must originate.socialDiscovery
: Indicates whether application usage stories show up in the ticker or news feed.subcategory
: The subcategory that the application can be found under.termsOfServiceUrl
: The URL to the terms of service that is linked to the Login dialog.userSupportEmail
: The primary contact email for the application.userSupportUrl
: The URL for user support that is provided in the canvas footer.websiteUrl
: The URL of a website that integrates with the application.
Sample request
Following is a sample REST request that can be handled by the updateAppDetails
operation.
{ "apiUrl":"https://graph.facebook.com", "apiVersion":"v2.4", "apiUrl":"https://graph.facebook.com", "accessToken":"277549932397586|OcXfD2DJscrv7ZZjNuQd6ne8kRA", "appId":"277549932397586", "appDomains":"", "authDialogDataHelpUrl":"", "authDialogHeadline":"", "authDialogPermsExplanation":"", "authReferralDefaultActivityPrivacy":"", "authReferralEnabled":"", "authReferralExtendedPerms":"", "authReferralFriendPerms":"", "authReferralUserPerms":"", "authReferralResponseType":"", "canvasFluidHeight":"", "canvasFluidWidth":"", "canvasUrl":"", "contactEmail":"janaka@gmail.com", "deauthCallbackUrl":"https://www.google.lk", "migrations":"", "mobileWebUrl":"", "namespace":"", "pageTabDefaultName":"", "pageTabUrl":"", "privacyPolicyUrl":"", "restrictions":"", "secureCanvasUrl":"", "securePageTabUrl":"", "serverIpWhitelist":"", "socialDiscovery":"", "termsOfServiceUrl":"", "userSupportEmail":"connector@gmail.com", "userSupportUrl":"", "websiteUrl":"" }
Related Facebook documentation:
https://developers.facebook.com/docs/graph-api/reference/app#publishing
Sample configuration
Following is a sample proxy service that illustrates how to connect to Facebook with the init
operation and then use the banAppUser
operation. The sample request for this proxy can be found in banAppUser
sample request. You can use this sample as a template for using other operations in this category.
As a best practice, create a separate sequence to handle response payload errors. In the following sample, the sequence that handles errors is the faultHandlerSeq
.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="facebook_banAppUser" 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="appId" expression="json-eval($.appId)"/> <property name="uids" expression="json-eval($.uids)"/> <facebook.init> <apiUrl>{$ctx:apiUrl}</apiUrl> <apiVersion>{$ctx:apiVersion}</apiVersion> <accessToken>{$ctx:accessToken}</accessToken> </facebook.init> <facebook.banAppUser> <appId>{$ctx:appId}</appId> <uids>{$ctx:uids}</uids> </facebook.banAppUser> <respond/> </inSequence> <outSequence> <property name="messageType" value="application/json" scope="axis2" /> <send/> </outSequence> </target> <description/> </proxy>