Open viktorsmari opened 3 years ago
Can you give a little more information over exactly what you are trying to do and how you are attempting to do it? maybe an example of the problem?
For instance, Is this over the ZenPub GraphQL API or ... ?
Yes, this issue is an example: https://github.com/reflow-project/zenpub-client/issues/51
Imagine you have a resource and want to transfer it to a certain User called 'John'.
How would you find that user from a Dropdown, if there are 500 users on the platform?
For instance, Is this over the ZenPub GraphQL API or ... ?
Yes, we raised the issue in this API repo :wink: and we don't know which GraphQL query can search users by name
Ah, I see, different repo.
OK. This appears to be a ZenPub GraphQL Client UI issue, not a ZenPub GraphQL server or API issue.
Assuming more than 15 users are currently defined, either the client UI is constructing a hardlimit query to the GraphQL server, or far more likely it is displaying a limited maximum dropdown 'page' length number of the greater number of users from the query results. Not familiar with the UI framework, but the max displayed number and start position of such adropdown widget with a scrolling option is normally configurable.
@adam-burns Back to my question, how can I search users on the platform, by name?
I cannot find an example on how to do it. Is it possible on the API? Can you help me build an example query on how to do it?
http://api.reflowproject.eu/api/explore
Try this and you get an error, because the API limit is 15
{users(limit: 16) {
edges {
id
name
}
}}
If you run it without limits, you only get 5 results.
{users {
edges {
id
name
}
}}
This means that we can paginate and get 15 users per request, but that is not what we are looking for here.
Again, if we have 500 users, how can I find a user called 'John' ? :thinking:
Thank you for the query itself - that makes this issue crystal clear, and my previous comments misinformed.
Repeating the tests through GraphiQL myself, I get the same results. 15 works, 16 fails with
{ "data": null, "errors": [ { "locations": [ { "column": 2, "line": 1 } ], "message": "Bad limit, must be between 1 and 15", "path": [ "users" ] } ] }
On seeing this, I would think this must be a schema setting or configuration that should be changed, but I leave that assessment to folk who set up the server and can access to assess the api.reflowproject.eu GraphQL server instance state.
@adam-burns can someone help with this, or suggest a workaround?
A limit is arbitrary but necessary, since graphql allows infinite nesting of subtypes/queries.
The instance for api.reflowproject.eu now has the query return limit raised to 30.
Depends on if the end user is happy having to scroll / paginate multiple times to find the correct user he is giving the resource.
I don't think it matters that much if the limit is 15 or 30.
Imagine if we have 500 users on the platform, and we are trying to find 'John' in the list.
If we see 30 users at a time, we might need to scroll / paginate (trigger the next page) up to 17x times, until we are positive we have found John.
I think the end user might get frustrated that it is not possible to find users by name via filtering.
The longer term issue, in terms of a GraphQL client-side fetch all then search approach is fighting the design of GraphQL itself, its advantage over REST API is that it optimises and minimises query responses. Searches across entire userspaces calls for a GraphQL server-side API implementation.
I think we're getting confused about the answer because we're asking the wrong question.
Back to my question, how can I search users on the platform, by name?
The question is not how many users you can fetch but how you could find a user.
users
but instead of agents
as economicEvents
can be entitled to both organizations
and persons
.economicEventsFiltered
for agentsFiltered
that can take name
as an input.name
filter input to support wildcards like *iktorsm*
returns viktorsmari
usernameIs there something similar already implemented we can use? Is there a plan to implement it? The only reason we currently need it is to enable users to define the receiver.id
on an economicEvent
This ticket was checked against the BonFire API. Resolution: Similar to ZenPub, there is no way of having filtered query Details See the screenshot with available queries in BonFire:
Example use case:
We need this for a Select, when we are selecting which user to transfer a resource to. The
users
query returns max 15 users, but what if we have 100 users and we need to filter and find 'John' for example.Is there a query on the API that allows us to find users by name?