Implementing IS FRIENDS WITH
Summary
0.8 defines a IS_FRIENDS_WITH filter in the javascript API. This requires an idSpec value to be passed to the server. However this is not viable in 0.8.1 as the REST/jsonrpc calling sequence uses filterBy, filterOp and filterValue.
To solve this impedance mismatch I propose adding the following text to areas of portable contacts spec:
Section 2:
Pseudo Field – A field name prefixed with an '@' sign is defined as a psuedo-field. This is generally used for filtering or sorting queries. The actual contents of pseudo fields are not returned in data responses.
Add a new section 7.2.3 - Pseudo Fields
@friends - A pseudo field that represents the friends of this person represented as an array of ID values. This field is used by filterBy requests.
To determine if two people are friends:
/people/@me/@self?filterBy=@friends&filterOp=contains&filtervalue=<someUserid>
To find mutual friends between two user IDs
/people/@me/@friends?filterBy=@friends&filterOp=contains&filterValue=<someuserid>
filterValue can take a specific person identifier or @owner or @viewer
Spec Updates
Updated section 6.6 of the RESTful Protocol Specification