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

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 47 Next »



Overview

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

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

OperationDescription
createAlbumCreates an album.
getAlbumDetailsReturns details of an album.
postPhotoToAlbumAdds photos to an album.

Operation details

This section provides details on each of the operations.

Creating an album

The createAlbum operation creates a new album based on the specified details.

createAlbum
<facebook.createAlbum>
	<userId>{$ctx:userId}</userId>
	<message>{$ctx:message}</message>
	<name>{$ctx:name}</name>
	<privacy>{$ctx:privacy}</privacy>
	<location>{$ctx:location}</location>
	<isDefault>{$ctx:isDefault}</isDefault>
	<place>{$ctx:place}</place>
</facebook.createAlbum>
Properties
  • userId: The profile for which you are creating the album.
  • name: Required - The title of the album.
  • message: The description of the album. This is what appears in news feed stories below the title of the album.
  • privacy:  The privacy setting for the album. Possible values are EVERYONE, ALL_FRIENDS, FRIENDS_OF_FRIENDS, CUSTOM and SELF. For more information on the privacy parameter, see https://developers.facebook.com/docs/reference/api/privacy-parameter.
  • location: The textual location of the album for non-page locations.
  • isDefault: Set to true if you want to create an application specific album.
  • place: The ID of a location page to tag the album with.
Sample request

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

Sample Request for createAlbum
{
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"CAACEdEose0cBAE0MQc25uyfYTS8zsZCu3wbJEZAcGc1Mzle1LbzJHI8LVAhvpWsSkQq4SrZAzZBruv3yWSoJZCSFFlWeal2sFOFplmjPfs39mxJLSF8YxPePkeuCU7cjYqEKCtW3qTEy6XUWHD1T1ush5Rhj85ZBEa94E7pP7XuuITLsFweZBoMMRX0QyGGWw0ZD",
"message":"this is a test message",
"name":"WSO2 connector",
"privacy":"{value:'EVERYONE'}"
}

Related Facebook documentation: 

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

Retrieving album details

The getAlbumDetails operation retrieves details of a specific user album.

getAlbumDetails
<facebook.getAlbumDetails>
	<albumId>{$ctx:albumId}</albumId>
	<fields>{$ctx:fields}</fields>
	<connection>{$ctx:connection}</connection>
</facebook.getAlbumDetails>
 Properties
  • albumId: The ID of the album.
  • fields: The fields which belongs to an object.
Sample request

Following is a sample REST request for the getAlbumDetails method.

Sample Request for getAlbumDetails
{
	"apiUrl":"https://graph.facebook.com",
	"apiVersion":"v2.4",
	"accessToken":"CAACEdEose0cBAPas3EqVsnzvtvEyZAPdrXEgdRRHEYEa6wZBJzupmqxJQXnxQ75EHeyg9cZBa2lOgObUpdmTTfQLqryHHjAV5bgd7njEML9uZBAaNuYl6q1KjlCteifZA9THGTRsZBZBk2LQQEaaHZCxQmUsYh3RMghs9vDGhOZC0Y8ZAdVpRl3usfCRvitQtLNHPNKOWzy59peAZDZD",
	"albumId":"10150146071791729"
}

Related Facebook documentation : 

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

Adding photos to an album

This method allows users to post photos to the album. This does not require init to be called before the operation. Refer to multipart processing for detailed information.

postPhotoToAlbum
<facebook.postPhotoToAlbum>
    <albumId>{$url:albumId}</albumId>
    <apiUrl>{$url:apiUrl}</apiUrl>
    <apiVersion>{$url:apiVersion}</apiVersion>
    <accessToken>{$url:accessToken}</accessToken>
    <message>{$url:message}</message>
    <location>{$url:location}</location>
    <noStory>{$url:noStory}</noStory>
    <photoUrl>{$url:photoUrl}</photoUrl>
    <place>{$url:place}</place>
</facebook.postPhotoToAlbum>
 Properties
  • accessToken: The access token allows making requests to the API on behalf of a user

  • apiUrl: Indicates the URL of the Facebook API.

  • apiVersion: Version of the Facebook API

  • albumId: The unique identifier of the album.

  • location: A text location of the album for non-page locations.

  • message: The description of the photo.

  • noStory: If set to true, this will suppress the feed story that is automatically generated on a person's profile when they upload a photo using your app.

  • photoUrl: The URL of a photo that is already uploaded to the internet.
  • place: Page ID of a place associated with the Photo.

Sample request (Curl)

Following is a sample REST request for the postPhotoToAlbum method.

Sample Request for postPhotoToAlbum
 curl -X POST \
     -d "source=%7Bimage-data%7D" \
        http://localhost:8280/services/facebook_postPhotoToAlbum?album_id=3434523334&message=Test image

Related Facebook documentation: 

https://developers.facebook.com/docs/graph-api/reference/album/photos#publish

Sample configuration

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


getAlbumDetails
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="facebook_getAlbumDetails"
	   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="apiVersion"
				expression="json-eval($.apiVersion)"/>
      <property name="albumId"
				expression="json-eval($.albumId)"/>
      <property name="fields"
				expression="json-eval($.fields)"/>	
	  <property name="connection"
				expression="json-eval($.connection)"/>  
	  <facebook.init>
   	  	<apiUrl>{$ctx:apiUrl}</apiUrl>
    	<apiVersion>{$ctx:apiVersion}</apiVersion>
    	<accessToken>{$ctx:accessToken}</accessToken>
	  </facebook.init> 
    <facebook.getAlbumDetails>
		<albumId>{$ctx:albumId}</albumId>
		<fields>{$ctx:fields}</fields>
		<connection>{$ctx:connection}</connection>
	</facebook.getAlbumDetails>
	  <respond/>
    </inSequence>
    <outSequence>
      <property name="messageType" value="application/json" scope="axis2"/>
      <send/>
    </outSequence>
  </target>
</proxy>
  • No labels