System Admin Community version

Hello All,

  1. I have installed mattermost community version on my own server and accessing its API for the chat integration.
    Now I want to create a public channel via rest API and it’s giving 404 status code in response.

  2. Also in my system_admin console, I’m only getting Users in the User Management section and the other settings option is not visible to me.

3)The deletion of the direct channel using the API is giving 403 due to the permission issues, for which I add on the EnableAPIChannel permission in my config file on the server, so how to resolve that.

I’m a bit stuck in this can anyone pls help me out with this?

Thanks

Could you provide the request’s that your making, that are failing, for me to take a look at by any chance? Do feel free to redact any sensitive information, of course.

http://.../api/v4/channels (POST) method

Body:
{
“team_id”: “t1cizni8abdimx1f5r64bmb3nw”,
“name”: “postman_test_group”,
“display_name”: “Postman Test team”,
“purpose”: “This is the group created via postman hit for the endpoints test.”,
“type”: “O”
}

Response:
{
“id”: “store.sql_channel.get_channels.not_found.app_error”,
“message”: “No channels were found.”,
“detailed_error”: “”,
“request_id”: “dzc9dooizpr65fbnmorzzza9sr”,
“status_code”: 404
}

Permissions

If creating a public channel, create_public_channel permission is required. If creating a private channel, create_private_channel permission is required.

It is req according to the documentation but where can I set these?

Hello, @abhishek7504

These permissions are configurable if you are running on either E10 / E20 offering which allows you to have access to the Advanced Permissions.

From there, you are able to refine the permission of users based on the System or Team Override Scheme in the documentation.

May I know if you would consider upgrading to either one of the Enterprise offering to tackle this one down?

Thanks for your reply actually I’m using the community version currently, so does the team creation can’t be done in this version?
And does I have to upgrade to enterprise version to access this?

Hi, @abhishek7504

You are most welcome. May I know if you are the System Administrator and have created the personal access token with the System Admin permission based on the screen shot below?

You should be able to create using the following sample cURL as long as you have the personal token created using the permission above:

curl --location --request POST "https://<URL>/api/v4/channels" --header "Authorization: Bearer XXXXXXXXXXX" --header "Content-Type: application/json" --header "X-Requested-With: XMLHttpRequest" --data "{\"team_id\":\"XXXXXXXXXXX\", \"name\":\"api_public_channel\", \"display_name\":\"API Public Channel\", \"type\":\"O\"}"

Hmm, this is intriguing, especially because the 404 error is not even referenced on the API documentation. @ahmaddanial do you think that this could be a database issue? I’m thinking it may be, based on the error seen here:

which leads me to think that there is a table (or multiple) missing, or improperly configured, etc.

Is this a possibility?

Does the community version of mattermost restricts us from using the API for public/private channel creation as I’m able to create a direct message channel using it’s API.

May be some setting changes are required, below I’m posting the settings pls have a look and let me know how I can made up changes.

“ServiceSettings”: {
“SiteURL”: “”,
“WebsocketURL”: “”,
“LicenseFileLocation”: “”,
“ListenAddress”: “:8065”,
“ConnectionSecurity”: “”,
“TLSCertFile”: “”,
“TLSKeyFile”: “”,
“TLSMinVer”: “1.2”,
“TLSStrictTransport”: false,
“TLSStrictTransportMaxAge”: 63072000,
“TLSOverwriteCiphers”: ,
“UseLetsEncrypt”: false,
“LetsEncryptCertificateCacheFile”: “./config/letsencrypt.cache”,
“Forward80To443”: false,
“TrustedProxyIPHeader”: [
“X-Forwarded-For”,
“X-Real-IP”
],
“ReadTimeout”: 300,
“WriteTimeout”: 300,
“IdleTimeout”: 60,
“MaximumLoginAttempts”: 10,
“GoroutineHealthThreshold”: -1,
“GoogleDeveloperKey”: “”,
“EnableOAuthServiceProvider”: true,
“EnableIncomingWebhooks”: true,
“EnableOutgoingWebhooks”: true,
“EnableCommands”: true,
“EnableOnlyAdminIntegrations”: true,
“EnablePostUsernameOverride”: false,
“EnablePostIconOverride”: false,
“EnableLinkPreviews”: false,
“EnableTesting”: false,
“EnableDeveloper”: false,
“EnableOpenTracing”: false,
“EnableSecurityFixAlert”: true,
“EnableInsecureOutgoingConnections”: false,
“AllowedUntrustedInternalConnections”: “”,
“EnableMultifactorAuthentication”: false,
“EnforceMultifactorAuthentication”: false,
“EnableUserAccessTokens”: true,
“AllowCorsFrom”: “”,
“CorsExposedHeaders”: “”,
“CorsAllowCredentials”: true,
“CorsDebug”: true,
“AllowCookiesForSubdomains”: false,
“SessionLengthWebInDays”: 180,
“SessionLengthMobileInDays”: 180,
“SessionLengthSSOInDays”: 30,
“SessionCacheInMinutes”: 60,
“SessionIdleTimeoutInMinutes”: 43200,
“WebsocketSecurePort”: 443,
“WebsocketPort”: 80,
“WebserverMode”: “gzip”,
“EnableCustomEmoji”: false,
“EnableEmojiPicker”: true,
“EnableGifPicker”: false,
“GfycatApiKey”: “2_KtH_W5”,
“GfycatApiSecret”: “3wLVZPiswc3DnaiaFoLkDvB4X0IV6CpMkj4tf2inJRsBY6-FnkT08zGmppWFgeof”,
“RestrictCustomEmojiCreation”: “all”,
“RestrictPostDelete”: “all”,
“AllowEditPost”: “always”,
“PostEditTimeLimit”: -1,
“TimeBetweenUserTypingUpdatesMilliseconds”: 5000,
“EnablePostSearch”: true,
“MinimumHashtagLength”: 3,
“EnableUserTypingMessages”: true,
“EnableChannelViewedMessages”: true,
“EnableUserStatuses”: true,
“ExperimentalEnableAuthenticationTransfer”: true,
“ClusterLogTimeoutMilliseconds”: 2000,
“CloseUnusedDirectMessages”: false,
“EnablePreviewFeatures”: true,
“EnableTutorial”: true,
“ExperimentalEnableDefaultChannelLeaveJoinMessages”: true,
“ExperimentalGroupUnreadChannels”: “disabled”,
“ExperimentalChannelOrganization”: true,
“ExperimentalChannelSidebarOrganization”: “disabled”,
“ImageProxyType”: “”,
“ImageProxyURL”: “”,
“ImageProxyOptions”: “”,
“EnableAPITeamDeletion”: true,
“ExperimentalEnableHardenedMode”: false,
“DisableLegacyMFA”: true,
“ExperimentalStrictCSRFEnforcement”: false,
“EnableEmailInvitations”: true,
“DisableBotsWhenOwnerIsDeactivated”: true,
“EnableBotAccountCreation”: false,
“EnableSVGs”: true,
“EnableLatex”: false
},

“TeamSettings”: {
“SiteName”: “Mattermost”,
“MaxUsersPerTeam”: 2000,
“EnableTeamCreation”: true,
“EnableUserCreation”: true,
“EnableOpenServer”: true,
“EnableUserDeactivation”: false,
“RestrictCreationToDomains”: “”,
“EnableCustomBrand”: false,
“CustomBrandText”: “”,
“CustomDescriptionText”: “”,
“RestrictDirectMessage”: “any”,
“RestrictTeamInvite”: “all”,
“RestrictPublicChannelManagement”: “all”,
“RestrictPrivateChannelManagement”: “all”,
“RestrictPublicChannelCreation”: “all”,
“RestrictPrivateChannelCreation”: “all”,
“RestrictPublicChannelDeletion”: “all”,
“RestrictPrivateChannelDeletion”: “all”,
“RestrictPrivateChannelManageMembers”: “all”,
“EnableXToLeaveChannelsFromLHS”: false,
“UserStatusAwayTimeout”: 300,
“MaxChannelsPerTeam”: 2000,
“MaxNotificationsPerChannel”: 1000000,
“EnableConfirmNotificationsToChannel”: true,
“TeammateNameDisplay”: “username”,
“ExperimentalViewArchivedChannels”: true,
“ExperimentalEnableAutomaticReplies”: false,
“ExperimentalHideTownSquareinLHS”: false,
“ExperimentalTownSquareIsReadOnly”: false,
“LockTeammateNameDisplay”: false,
“ExperimentalPrimaryTeam”: “”,
“ExperimentalDefaultChannels”:
},

Here is m settings pls help me out in this I’m badly stuck in this I’m unable to create a private or public channel.

Hello, @abhishek7504

May I know what is the error that you are getting when you tried the cURL command I suggested earlier instead of using Postman? These settings look good when compared to mine which allows me to create the channel based on the cURL with the System Administrator personal token I shared earlier:

“RestrictPublicChannelCreation”: “all”,
“RestrictPrivateChannelCreation”: “all”,

@XxLilBoPeepsxX we can definitely look into that avenue. @abhishek7504 can you confirm if you are running on MySQL or PostgreSQL?

If you are on MySQL, run the SHOW Tables and DESCRIBE Channels SQL command.

If you are on PostgreSQL, run the \dt and \d+ Users command.

Share the output here so we can compare it with what I have.

@ahmaddanial I’m wondering if the fact that the website URL appears to not have been set in the configuration (unless it was redacted in the posting on the forum), it could be a missing variable in the requests made by the API to the server, to perform these commands, in the sense that none of the API queries could be completed because there is a missing variable (the URL’s TLD) in the API call point… Does that have any level of validity to it, or could it?

Hello @ahmaddanial sorry for the late reply here I’m sending you the screenshots for the command that you told me to run. I’m using the Postgres database.

For Channels:

For Users:

These are the output pls check.

Hello, @abhishek7504

While the Channels table looks similar to mine, can I confirm that the Indexes for Users has this at END of the result?

Access method: heap

Circling back to this one, can you provide me with the screen shot of what you are seeing on your end when you run this cURL command?

@XxLilBoPeepsxX I would assume that it was redacted for security and privacy purposes but @abhishek7504 can you please confirm on that?

1 Like

Hello @ahmaddanial Thanks for the support but the issue is resolved do not know how but I test it today so it was working.

2 Likes