According to the spec ANY key that is unique should be able to be specified by the indexBy field.

So the ID is one, and the name might be :)

Cassie and i had a conversation on the list about this before and we decided to make a general functionality for this in the social services that reworded the data array's, so that the containers don't have to bother with this, but we also agreed it's a pretty ugly construction to begin with :)

I'd say ... damn it all and just do whatever the gadget requests ... in other words if they want to set indexBy to gender ... just reword the array to 2 entries, one for male and one for female, with both containing only the last entry (since the other ones are over-written every time). Thats a lot easier then to decided for the container what fields are or are not unique.. and if the gadget requests something stupid, it's their problem and not ours :)

So i'd go for something like:

foreach <results> as <result>:
        newOutput[ <result key> ] = <result>
return newOutput

simple, dirty, effective :)

On Jul 11, 2008, at 4:03 PM, Gonzalo Aune wrote:

Hi people,

im working adding the indexBy param to the query as the 6.5 section of the
RESTful API Spec says, and i was wondering how it exactly works:

a) The unique key is choosed between the results, ie:

{"name":{"familyName":"Aune 2","givenName":"Gonzalo
2","unstructured":"Gonzalo 2 Aune
2"},"gender":{"displayValue":"Male","key":"MALE"},"id":"2"},
{"name":{"familyName":"Aune 3","givenName":"Gonzalo
3","unstructured":"Gonzalo 3 Aune
3"},"gender":{"displayValue":"Male","key":"MALE"},"id":"3"}

The unique keys are id, familyName, givenName, unstructured, but no the
gender

b) The unique key is the one of the OpenSocial spec, ie, the 'id'.

I think the option A is the right, but im asking you people to help me with
this =)

G.-

Reply via email to