Social graph connections
One of the most useful features of Apigee's API BaaS is the ability to create connections between entities, which allow you to model arbitrary relationships between entities. This feature is particularly powerful when applied to user entities by allowing you to model complex social graphs between users as well as groups of users.
To make the social graph possibilities of entity connections even easier to achieve, API BaaS also has special support for a default following/followers relationship, which offers these additional features:
Reciprocal connection: If a
followingconnection is made between a user and another user, a reciprocal
followersrelationship will be created automatically. In contrast, all of other entity connections are one-way, meaning any reciprocal relationship must be created manually.
Activity feed subscription: The followed user's activities will automatically be posted to the following user's activity feed. For example, if Arthur is following Ford, then any activities published by Ford that Arthur is allowed to see will appear in Arthur's activity feed.
To create a following/followers connection between two entities, create the connection as you would any generic entity connection. For full details on creating connections, see Connecting entities.
For example, the following request would create a following/followers relationship between two
user entities with the usernames 'Fred' and 'Barney':
followingconnection. Creating a
followerconnection would not create a reciprocal
This would retrieve a list of the users that Barney is following:
And this would retrieve a list of users that are following Fred:
You can extend this connection structure to create connections using any relationship. For example, you could use
likes to denote a connection between a user and his dog with this
Note that in this case a reciprocal connection is not automatically created. To do so you would need to manually create the reciprocal connection with another
POST such as:
For more information on using entity connections, see Connecting entities.