Find returns more values that the ones Im asking



Im doing this in Python:

sgDict = sg.find( "Group", [ [ 'code', 'is', 'Leads & Supervisors' ] ], [ 'users' ] ) 

so I can find the users in that group but it returns this:

[{'type': 'Group', 'id': 8, 'users': [{'type': 'HumanUser', 'name': 'User Name', 'id': 38}]

and I waiting this:

{'type': 'HumanUser', 'name': 'User Name', 'id': 38}

It is my mistake or it is a bug?


Thank you in advance

1 条评论

  • 0
    Ben Hadden

    Hi Sergio,

    The thing to keep in mind with the API is that a find() request on an entity type will return that entity, along with any fields on that entity you specify.  If you'd like to return a Person instead of a Group, try doing a find() search on HumanUser:

    sgDict = sg.find('HumanUser',[['groups','is',{'type':'Group', 'id':'8}]],['name'])

    Let me know if this works for you!