Page 1 of 1

How to get all mantis users via api rest?

Posted: 06 Mar 2018, 14:26
by Cosmin
Hello,
Is any way to get all mantis users through api rest?
Thanks

Re: How to get all mantis users via api rest?

Posted: 09 Mar 2018, 10:39
by atrol
There is no such function in REST API at the moment.

Re: How to get all mantis users via api rest?

Posted: 09 Mar 2018, 17:45
by Starbuck
Plugin time?

Re: How to get all mantis users via api rest?

Posted: 09 Mar 2018, 21:31
by Starbuck
I don't know if there is a way to create a plugin for the REST API yet.
For now, this is a drop-in replacement to the core file that handles the REST requests for users.

That entire file will replace /api/rest/restcore/users_rest.php.

Changes to support this feature:
- There is now a GET end-point at the root of the /users path : /api/rest/users/
- Added function rest_users_get, a slightly modified version of reset_user_get_me that just loops on all users.

If this does the job I'll submit the enhancement to core for consideration.
Extensions from this can easily get any specific user, get users filtered by criteria, and sort the results.

Re: How to get all mantis users via api rest?

Posted: 09 Mar 2018, 21:42
by Starbuck
I just found a good example for adding a new REST end point.
If the enhancement is rejected as a core update, I'll publish it as a plugin.

Re: How to get all mantis users via api rest?

Posted: 09 Mar 2018, 22:20
by atrol
@Starbuck I am pretty sure this will not work on installations with lots of users due to various reasons (exceeding post max size, max cpu and memory).
There is the need to implement a paging similar to the paging that is implemented for issues.

Re: How to get all mantis users via api rest?

Posted: 09 Mar 2018, 22:51
by Starbuck
Now you're sounding like a user. We've provided a fast and free solution, changing a No answer to Yes, and you're saying it's not good enough. :mrgreen:

We can provide solutions fast, good, or cheap - pick two. For a better balance, options available to businesses that have high demands as you describe, including:
  • Get one of those many Mantis users to enhance the provided code.
  • Motivate someone else to enhance it.
  • Put the software into an environment that will handle the user load.
  • Increase the response timeout for a client process making the REST request.

Re: How to get all mantis users via api rest?

Posted: 10 Mar 2018, 13:26
by atrol
Starbuck wrote: 09 Mar 2018, 22:51 Now you're sounding like a user.
User? Users are typically not aware of such technical constraints.
I am writing as a developer, kwowing how it works in background, being aware of real life use cases.
Starbuck wrote: 09 Mar 2018, 21:31 If this does the job I'll submit the enhancement to core for consideration.
If you send a PR, the mentioned paging should be implemented, to increase the chance that the change will become part of the core.

BTW, I tried the patch on a system similar to the instance on mantisbt.org and got exactly what I expected to get:
A stressed server, especially database and finally: PHP Fatal error: Allowed memory size exhausted.

For users reading this:
The patch works in general, but shouldn't be used on systems with large number of users and/or projects.

Re: How to get all mantis users via api rest?

Posted: 17 Jan 2019, 14:45
by pgiraud
atrol wrote:I tried the patch
@atrol or @Starbuck can you please point me to the mentioned patch?

I'm also interested in any resource that could help me writing a plugin to enhance or extend the current Rest API. I'd like to be able to search for users, or update a user (changing his email address for example).

Thanks for you help.

Re: How to get all mantis users via api rest?

Posted: 18 Jan 2019, 08:11
by pgiraud
Oh crap, sorry for the noise. I didn't figure out that there was a patch behind the "drop-in replacement" link.

Re: How to get all mantis users via api rest?

Posted: 21 Jan 2019, 21:24
by Starbuck
No prob. If you'd ike to discuss plugin creation, check out the forum section dedicated to that topic. (See my sig)
Just a note - I'm no expert in the area and don't have a lot of time right now to provide many details. My goal is to provide a forum for such discussions, to attract "like minds" to share information on a topic, even if I myself can't be the answer guy.
But give it a shot!

Re: How to get all mantis users via api rest?

Posted: 25 Nov 2019, 12:03
by keessonnema
@Starbuck I came across this thread and saw your replies. I haven't found any plugin that adds your endpoints so I assume it has never been finished? I'm busy replacing the SOAP API with the REST API but while investigating I ended up missing the users endpoint like in the SOAP API.

Are you still planning on adding this to a plugin? My knowlegde of plugins is a little too limited to implement this as of now, but I will look into it.

Re: How to get all mantis users via api rest?

Posted: 09 Jun 2020, 20:19
by Starbuck
I'm just seeing your inquiry, sorry. I wasn't planning on doing anything else with this.