[SOLVED] Submitting a post via REST: You do not have the appropriate permissions

Hi there!


I’m trying to submit a post via the REST API.
I am able to authenticate.
However, when trying to submit the post, I get a the error “You do not have the appropriate permissions”.

Steps to reproduce

I’m using Mattermost preview version 3.4.0 running in Docker.
My request is the following:

Request URL:

Request body:
{“user_id”:“dm1”,“message”:“First test 12345.”,“channel_id”:“upmx6ed7f7b3dmazncjzmoaric”}

Expected behavior

I expect a response with status code 200 and the message should be added to the message stream.

Observed behavior

I got the following error response:

{“id”:“api.context.permissions.app_error”,“message”:“You do not have the appropriate permissions”,“detailed_error”:"",“request_id”:“d46p13oujpgi3bh3g6n1kdru5a”,“status_code”:403}

What I’ve tried and didn’t work:
Using “town-square” as the channel id. This gave another error:

{“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/teams/teem1/channels/town-square/posts/create’. Typo? are you missing a team_id or user_id as part of the url?”,“status_code”:404}

Any ideas about what I’m doing wrong?
Thanks :slight_smile:

Hi @domrue, did this issue get solved for you or are you still getting errors?

Hi @domrue,

I was having a similar issue earlier today, have you tried using the id for the team rather than it’s name?

If I POST to:

{"channel_id": "8yce4jb34irc9mrkjcnj7k8p1a", "message": "Message from API!"}

I get the same error you are reporting, however if I try:

{"channel_id": "8yce4jb34irc9mrkjcnj7k8p1a", "message": "Message from API!"}

I get the expected response, and my message is posted to the channel on my Mattermost server.

As a side note, I’ve noticed that using the id or name of the team when returning a channel list give different results.

http://localhost:8065/api/v3/teams/t8wxrxbwwtbwfbuteahkigunry/channels/ is returning all expected channels (channels, private groups and direct messages).

While http://localhost:8065/api/v3/teams/development/channels/ is only returning a list of channels for direct messages.

Hopefully this helps, I’ve only been looking at the API for a couple of days but happy to help where I can.


Indeed using the team id rather than the team name solved the problem!

Thanks :relaxed: