Result for users search - missing fields

Any issue about Cyclos 4 scripting and Webservices

Moderators: rmvanarkel, hugo, alexandre

Post Reply
jakob.schumann
Posts: 20
Joined: Thu Apr 23, 2020 5:37 pm

Result for users search - missing fields

Post by jakob.schumann »

Hello,

when using the endpoint GET /​users I have two problems:

1) is it somehow possible to return the status of the users? It is already possible to filter by more than one status but without the user status being in the resulting fields it is not possible to differentiate them.

2) What do I have to do to retrieve the address(es) of the user with the search? Using "address" or "addresses" in the "fields" parameter does not help, neither does using "addressResult". But the schema for the result as shown on https://demo.cyclos.org/api/does contain the address? I am not searching for address fields, just listing all users of a group/groupSet and would rather not make additional queries for /{user}/addresses for each user.

Thanks in advance,
Jakob
admin_de2
Posts: 81
Joined: Wed Dec 31, 1969 9:00 pm

Re: Result for users search - missing fields

Post by admin_de2 »

Dear Alexandre,

this looks indeed like an error.
I tested with postman:
https://.../api/<username>/addresses
=> It brings back the address like expected
And:
https://.../api/users/data-for-search
Results correctly in:

Code: Select all

    "fieldsInSearch": [
        "name",
        "username",
        "phone",
        "image",
        "address",
        "accountNumber",
        "email",
        ...
    ],
Result of fields in list does not show up "addresses":

Code: Select all

    "fieldsInList": [
        "name",
        "username",
        "email",
        "phone",
        "accountNumber",
        ...
    ],
In the permission settings, there is no option to enable "adresses" to appear in the user result lists; it's defaulted statically to "no".
So, it would make very sense not to display all images and all addresses of all users in user result lists.
As well, it would make very sense to let it have enabled as well for the API-clients.

I reviewed the settings three times. The external api client is able to see user's addresses.
But it's not able to get addresses with the users/ api endpoint with "field=address":

Code: Select all

https://.../api/users?fields=username,phone,address.zip
=> shows only all other fields but not address.zip

Code: Select all

https://.../api/users?fields=address
=> shows array elements which are all empty (since no other field except "address" is given).

So, i ask you kindly for:
  • Can you please commit that my assumption is correct that the missing addresses come from the missing "fieldsInList"-entry and therefor for the lack of beiing able to set permissions for it?
  • Therefore currently no addresses can be retrieved with users/ endpoint (which will cause an big bunch of extra API requests in this case), true?
  • Will be hopefully an issue for future releases?
Thank you, Thomas
admin_de2
Posts: 81
Joined: Wed Dec 31, 1969 9:00 pm

Re: Result for users search - missing fields

Post by admin_de2 »

Just a tiny addition:
The documented parameter addressResult should specifiy the kind of result for found addresses.
Which sense does it make when no address at all is returned?
Thx, Th.
admin_de2
Posts: 81
Joined: Wed Dec 31, 1969 9:00 pm

Re: Result for users search - missing fields

Post by admin_de2 »

Another one:
demo.cyclos.org/api/users
brings back addresses in some cases - regardless of parameter addressResult
When i do the same with my own installation, no addresses at all appear and the result set is only NOT EMPTY if addressResult is set different to "all". Settings to "all" leads always to an empty result (means, "[]" - just one empty array, not many empty elements).

Now i'm puzzled again quite a bit.

Hope you may spot this out.

Thank you very much!!

Th.
rleon
Posts: 4
Joined: Wed Jun 10, 2020 9:42 am

Re: Result for users search - missing fields

Post by rleon »

Hi,
1) The user status is not sent in the results (although you can filter by that field)
2) The users endpoint does not return the user's address (although you can filter by that field). If you want to search users with addresses you can use the map endpoint "api/users/map"
Post Reply