Mattermost, Inc.

Sending [user_id] in the Create a Post request

How to send [user_id] in the request (payload) of the end point Create a Post, logged with an Adm.

Why in the API documentation only allows a (payload) like this:
{
“channel_id”: “string”,
“message”: “string”,
“root_id”: “string”,
“file_ids”: [
“string”
],
“props”: {}
}

I would like to send the (payload) this way:
{
“channel_id”: “string”,
“message”: “string”,
“user_id”: “quteuwqteuqt1212ut1u21”,
“root_id”: “string”,
“file_ids”: [
“string”
],
“props”: {}
}

@netxande, our REST API does not allow you to post as an arbitrary user in that way. The authentication token is used to identify the user in question and cannot be overridden.

If you are looking for additional flexibility here, you might consider using our plugin API to extend the server: https://pkg.go.dev/github.com/mattermost/mattermost-server/v5/plugin?tab=doc

1 Like

Thanks for the clarification, I realized afterwards that I was going the wrong way. In fact the modeling is more consistent with the identification of the session token.