code: func CreateDashboardSnapshot(c *m.ReqContext, cmd m.CreateDashboardSnapshotCommand) {
  	if cmd.Name == "" {
  		cmd.Name = "Unnamed snapshot"
  	}
  
  	var url string
  	cmd.ExternalUrl = ""
  	cmd.OrgId = c.OrgId
  	cmd.UserId = c.UserId
  
  	if cmd.External {
  		if !setting.ExternalEnabled {
  			c.JsonApiErr(403, "External dashboard creation is disabled", nil)
  			return
  		}
  
  		response, err := createExternalDashboardSnapshot(cmd)
  		if err != nil {
  			c.JsonApiErr(500, "Failed to create external snaphost", err)
  			return
  		}
  
  		url = response.Url
  		cmd.Key = response.Key
  		cmd.DeleteKey = response.DeleteKey
  		cmd.ExternalUrl = response.Url
  		cmd.ExternalDeleteUrl = response.DeleteUrl
  		cmd.Dashboard = simplejson.New()
  
  		metrics.M_Api_Dashboard_Snapshot_External.Inc()
  	} else {
  		cmd.Key = util.GetRandomString(32)
  		cmd.DeleteKey = util.GetRandomString(32)
  		url = setting.ToAbsUrl("dashboard/snapshot/" + cmd.Key)
  
  		metrics.M_Api_Dashboard_Snapshot_Create.Inc()
  	}
  
  	if err := bus.Dispatch(&cmd); err != nil {
  		c.JsonApiErr(500, "Failed to create snaphost", err)
  		return
  	}
  
  	c.JSON(200, util.DynMap{
  		"key":       cmd.Key,
  		"deleteKey": cmd.DeleteKey,
  		"url":       url,
  		"deleteUrl": setting.ToAbsUrl("api/snapshots-delete/" + cmd.DeleteKey),
  	})
  }
docs: // POST /api/snapshots