How to get all mantis users via api rest?

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
Cosmin
Posts: 5
Joined: 15 Jan 2018, 09:22

How to get all mantis users via api rest?

Post by Cosmin »

Hello,
Is any way to get all mantis users through api rest?
Thanks
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

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

Post by atrol »

There is no such function in REST API at the moment.
Please use Search before posting and read the Manual
Starbuck
Posts: 219
Joined: 14 Feb 2006, 02:53
Location: USA
Contact:

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

Post by Starbuck »

Plugin time?
If you want Mantis to work differently, use or create a plugin. Visit the Plugins forums.
Ask developers to create a plugin that you need - and motivate them to help you!
Starbuck
Posts: 219
Joined: 14 Feb 2006, 02:53
Location: USA
Contact:

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

Post 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.
If you want Mantis to work differently, use or create a plugin. Visit the Plugins forums.
Ask developers to create a plugin that you need - and motivate them to help you!
Starbuck
Posts: 219
Joined: 14 Feb 2006, 02:53
Location: USA
Contact:

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

Post 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.
If you want Mantis to work differently, use or create a plugin. Visit the Plugins forums.
Ask developers to create a plugin that you need - and motivate them to help you!
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

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

Post 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.
Please use Search before posting and read the Manual
Starbuck
Posts: 219
Joined: 14 Feb 2006, 02:53
Location: USA
Contact:

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

Post 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.
If you want Mantis to work differently, use or create a plugin. Visit the Plugins forums.
Ask developers to create a plugin that you need - and motivate them to help you!
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

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

Post 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.
Please use Search before posting and read the Manual
pgiraud
Posts: 3
Joined: 17 Jan 2019, 08:48

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

Post 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.
pgiraud
Posts: 3
Joined: 17 Jan 2019, 08:48

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

Post by pgiraud »

Oh crap, sorry for the noise. I didn't figure out that there was a patch behind the "drop-in replacement" link.
Starbuck
Posts: 219
Joined: 14 Feb 2006, 02:53
Location: USA
Contact:

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

Post 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!
If you want Mantis to work differently, use or create a plugin. Visit the Plugins forums.
Ask developers to create a plugin that you need - and motivate them to help you!
keessonnema
Posts: 5
Joined: 12 Mar 2019, 14:08

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

Post 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.
Starbuck
Posts: 219
Joined: 14 Feb 2006, 02:53
Location: USA
Contact:

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

Post by Starbuck »

I'm just seeing your inquiry, sorry. I wasn't planning on doing anything else with this.
If you want Mantis to work differently, use or create a plugin. Visit the Plugins forums.
Ask developers to create a plugin that you need - and motivate them to help you!
Post Reply