Mattermost 3.4 - API - 404 - Unable to post users/ids through the api


#1

Summary

Using Postman, I am unable to get a response when I post a user id into the endpoint users/ids using Postman.

Steps to reproduce

Following the api reference:
https://api.mattermost.com/#tag/users%2Fpaths%2F~1users~1ids%2Fpost

Mattermost 3.4 using Docker
Postman Chrome plugin
Post:
http://localhost/api/v3/users/ids
Header:
Authorization: Bearer {token}

Body (raw):
["{user_id}"]

Expected behavior

A similar output of get users/me but for the specified user

Observed behavior

{“id”:“api.context.404.app_error”,“message”:“Sorry, we could not find the page.”,“detailed_error”:“There doesn’t appear to be an api call for the url=’/api/v3/users/’. Typo? are you missing a team_id or user_id as part of the url?”,“status_code”:404}


#2

Hi @protoz,

That endpoint was added in Mattermost 3.5 so you’ll have to upgrade your instance if you’re going to use it. If you’re not wanting to upgrade right now, may I ask what you’re trying to do with this? I can try to point you to the right APIs for it

As for the API reference, they’re for our latest released version (currently Mattermost 3.5.1). We’re planning to keep documentation for each version starting from 3.5, so there’s no documentation for 3.4 or earlier.


#3

After the winter break I updated my environment to 3.5.1 and noticed there were some other undocumented changes with how to pull out data so I haven’t been able to get back to this endpoint. Changes such as channel_id being nested inside [‘data’][‘post’] where is was top level before and now we are seeing the connection close after a minute of no activity where it was working without issue on 3.4.

This call is for getting user data such as user name and email based on user id of the person making the request so it can be included in a request to an external system


#4

If it’s just for the currently logged in user, you can use /api/v3/users/me. There’s also /api/v3/users/{userId}/get to get the user with any id. Those both exist prior to 3.5, but that probably doesn’t matter now that you’ve upgraded. In 3.5 and onwards, there’s also additional APIs to get the user by their username or email as well if necessary.

As for the other changes to the API, we made some changes in 3.5 to help performance on the webapp, but we should’ve paid more attention to backwards compatibility for integration developers. Going forward, we’re hoping to give significant warning of any APIs that will be changed or removed (at least a few months) to keep this from happening again


#5

I’m all back to how it functioned on 3.4. We were taking advantage of Mattermost not closing the connection after a period of time so I had to add a thread to ping the websocket every 30 seconds to resolve my connection is already closed issue.

I didn’t see an easy way to pull that data without reading the output of the api above last month. We’re building an automated access request system to get access to multiple external systems so making sure the correct user name and email are being sent across is important. Now that it’s back in a usable state with the 3.5 api I should be able to experiment some more and see if those other requests can do it a little cleaner.

Thanks for the heads up on the work you are doing for making it easier for devs to prepare for major changes. That is was a little frustrating until I updated to 3.5.x


#6

Glad to hear you got that fixed! If you have any other questions about the API, feel free to post back here.