Cannot connect to Mattermost api v4

Hi:

Yesterday we installed the Mattermost from Bitnami launchpad for Azure.

The website works fine, however I tried the whole day to connect to the api using postman without luck.

I create a bot account with a access token and there is no way to get a successful connection the the api.

One think that we noticed is that when we try connect via ssh with the following command:

curl localhost:8065

We get a html error saying that “Cannot connect to Mattermost”.

But when I browse the Mattermost website from a browser is working fine. The problem is that we cannot access the api.

We tried different endpoints like the login and teams without luck.

Any idea what we are missing ?

Thanks

David

Hello, @dsapo

Since you mentioned that you were able to access Mattermost through the web browser, I would like to understand a little better the address you used to access it. Were you accessing it through http://localhost:8065 itself or rather https://127.0.0.1:8065?

Were you trying to run the curl command from the same machine that you deployed Mattermost on? Can you also provide some screen shots on how you try to utilize the API on Postman?

Lastly, I would like to know if you are able to use a simple cURL command to send a message to a room via terminal in the machine you deployed Mattermost on:

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

Hello:

The issue is solved by removing the port number in the api route.

Based on the documentation I thought that the port number 8065 was necessary, but it was not, so once we took it out, we were able to access the api using postman.

Thanks

David

1 Like

Hello, @dsapo

Wonderful! Happy to know that the issue is solved on your end. :+1: