/api/v4/posts not working, everything else is!?


/api/v4/posts endpoint only returns
{“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/v4/posts/’. Typo? are you missing a team_id or user_id as part of the url?”,“status_code”:404}

Steps to reproduce

I installed latest Mattermost (v5.32.1) from scratch on debian 10 without any problems.
Every API call is working, e.g.

Only /api/v4/posts returns 404

Full api url is like

However, the whole application is working, just the /posts endpoint returns 404!?


The error appears as user in browser as well as in postman or any other way to call the api.


From the nginx logs you can see, /api/v4/posts simply generates a 404 error:
myiphere - - [26/Feb/2021:15:39:59 +0100] “POST /api/v4/posts/ HTTP/1.1” 404 251 “-” “PostmanRuntime/7.26.10”

Hello, @Sushimaster

I attempted to use the /api/v4/posts without any issues on my end. Eg.

curl --location --request POST "<URL>/api/v4/posts" --header "Authorization: Bearer <personal_token>" --header "Content-Type: application/json" --header "X-Requested-With: XMLHttpRequest" --data "{\"message\":\"This is a test message\", \"channel_id\":\"<channel_id>\"}"

Can you please confirm if you are still facing the same issue when you use this cURL command on your end and if yes, what is the error that you are seeing on your side?

Also, does the user token have the right permission to post on channels?

1 Like

Oh shit, I forgot to reply!

The problem was, that I did not used “raw” (which is the correct setting!) in body field (here: Postman), that causes the problem.


However, the error code is terribly misleading, because 404 says the URL would be wrong, but the sent data was malformed. That’s a huge difference!

1 Like

Hi, @Sushimaster

No worries. Just to make sure that this is an actual issue with Mattermost instead of Postman, did you try out the CLI I shared earlier and verify if you managed to make it work or does it also fail with the 404 error?

Just want to make sure that we understand the problem properly.

1 Like