Comments (1)
In https://developer.rocket.chat/api/rest-api/query-and-fields-info#fields-example , it's explained:
To only return the usernames for users, you would do something like this:
http://localhost:3000/api/v1/users.list?fields={ "username": 1 }
However, as discussed with @rodrigok, this example won't only return usernames, it would return the username field among other default fields, i.e. those listed at https://github.com/RocketChat/Rocket.Chat/blob/develop/app/api/server/lib/users.js#L53
Maybe the documentation is just out of date because this comment (back in 2017) looks to match with what explained in the current documentation.
So for me it boils down to the following questions:
- Do we still want to illustrate the same example, i.e "how to only return specific fields ? (my opinion is it's an useful use case).
- If we do, how do we do that ?
- Do we rather want to remove this use case, and explain how the default fields are coming into place (the specified fields in the request are merged with the defaults ones)
In addition, at https://developer.rocket.chat/api/rest-api/methods/users/list - where a ref to the
Query and Fields Query Parameter
page above is inserted - it is mentioned :Gets all of the users in the system and their information (...)
all could let us think that what's returned by default (without
fields
parameter) are all the fields the callee has access to, while it's rather all fields the callee has access to among the default fields.Also I would repeat there that including a specific field with
1
doesn't filter out the default fields from the answer, but rather merge it with some default fields.Once we're clear with the points above, I'd be glad to propose a Pull Request.
@mhow2 You are right.
I've tested the endpoints and passed in the parameters like documented.
Setting a field value of 0
, only excludes it from all the fields being returned. Meanwhile, some other fields(defaults) are being returned along.
Since there are just so many fields, not logical to go eliminating one after the other.
There's no clear way of returning just particular fields stated.
from developer-docs.
Related Issues (20)
- Update Node js version and Yarn command in Linux development environment setup
- Add information manage node version in WSL setup HOT 1
- rooms.saveRoomSettings API docs incorrectly specify the name of the endpoint and the HTTP method, lack examples HOT 5
- Image not rendering for forums.rocket.chat HOT 5
- Examples for stream-room-messages and stream-livechat-room are interchanged HOT 11
- Suggest official Go SDK over third-party one HOT 1
- Use of Flipper for debugging is not mentioned in "Mobile App Environment Setup" HOT 1
- `yarn prettier` instead of `yarn prettier-lint` in "Testing your Mobile App" section HOT 2
- Contribution Guidelines Link is Broken - dev docs HOT 1
- Url incorret API HOT 1
- Getting "page not found error on URL : https://developer.rocket.chat/rocket.chat/contribute-to-rocket.chat" HOT 2
- Possible error in OAuth2 documentation HOT 1
- Missing information in endpoint HOT 1
- Incorrect Example Result on GetThreadMessages REST API page
- Incorrect query parameter on GetThreadMessages REST API page
- Willing to contriute as a Mentor for GSoC'24 HOT 1
- [Accessibility] : Dark Mode Theme HOT 2
- Missing information for "stream-room-messages" HOT 1
- DeprecationWarning HOT 1
- Install Dependencies `event-loop-stats` and `isolated-vm` on Windows
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from developer-docs.