Extending the Person Object

While exploring the Person object, you might have noted a need for additional layers of data to help you drill down to exactly the information you want to use. Fortunately, OpenSocial defines extensions to several Person fields to allow developers to obtain more specific details. These extensions are broken down into the following subsections.

Addresses (opensocial.Address)

The OpenSocial Address object is a standardized way to display an address in an OpenSocial application. Address information may contain street information, data about the type of place, and geographically relevant plotting data. For example:

"address": {
   "country": "United States",
   "latitude": 37.371609,
   "longitude": −122.038254,
   "locality": "Sunnyvale",
   "region": "California",
   "streetAddress": "701 First Avenue",
   "type": "work"

Depending on the container’s needs or implementation specifications, an OpenSocial Address object may contain a number of different fields. These are listed in Table 5-4.

Table 5-4. Address object fields



opensocial.Address.Field.COUNTRY (string)

The country of the address. May be used interchangeably with country.

opensocial.Address.Field.EXTENDED_ADDRESS (string)

The extended address specified as a string. May be used interchangeably with extendedAddress.

opensocial.Address.Field.LATITUDE (number)

The latitude of the address. May be used interchangeably with latitude.

opensocial.Address.Field.LOCALITY (string)

The address locality. May be used interchangeably ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.