import ( "github.com/mattermost/mattermost-server/v5/plugin" "github.com/mattermost/mattermost-server/v5/model" ) func (p *MyPlugin) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request) { siteURL := c.GetSiteURL() // Use the site URL to construct links or fetch resources ... }
import ( "github.com/mattermost/mattermost-server/v5/model" ) func (c *MyCommand) Execute(context *model.CommandArgs) (*model.CommandResponse, *model.AppError) { siteURL := context.GetSiteURL() // Use the site URL to construct links or fetch resources ... }Both of these examples demonstrate how to use the "GetSiteURL" method to obtain the base URL of the Mattermost server. This can be useful when developing plugins or commands that interact with the server.