Link

The Link element allows a developer to take advantage of application life-cycle events defined by a container. Such events might be application installs or uninstalls, or any other event in the day-to-day life of a social application. The container supports these features by sending relevant query parameters denoting the event to a URL endpoint specified within the Link node.

A Link node may take the following form under the ModulePrefs element:

<ModulePrefs>
    <Link rel="event" href="http://www.mysite.com/ping.php" method="POST" />
    <Link rel="event.addapp" href="http://www.mysite.com/add_app.php" />
    <Link rel="event.removeapp" href="http://www.mysite.com/remove_app.php" />
</ModulePrefs>

As you can see in the preceding example, the Link node has several associated attributes. They are listed in Table 3-5.

Table 3-5. Link attributes

Attribute

Description

rel

The string value that denotes the event being triggered. This value is required.

href

The URL to make a request to once the event has been triggered. This value is required.

method

The HTTP request method, either GET or POST, to use when making a request to the URL supplied in the href attribute. The default request method is GET. This is an optional attribute.

If a Link node is specified with a rel of opensocialevent (e.g., rel="event"), then any undefined life-cycle event types will be sent through to that href value by default. If there are one or more Link nodes with a rel of opensocialevent.type (e.g., rel="event.addapp"), then any ...

Get Programming Social Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.