code: func (hs *HTTPServer) QueryMetrics(c *m.ReqContext, reqDto dtos.MetricRequest) Response {
  	timeRange := tsdb.NewTimeRange(reqDto.From, reqDto.To)
  
  	if len(reqDto.Queries) == 0 {
  		return Error(400, "No queries found in query", nil)
  	}
  
  	datasourceId, err := reqDto.Queries[0].Get("datasourceId").Int64()
  	if err != nil {
  		return Error(400, "Query missing datasourceId", nil)
  	}
  
  	ds, err := hs.DatasourceCache.GetDatasource(datasourceId, c.SignedInUser, c.SkipCache)
  	if err != nil {
  		if err == m.ErrDataSourceAccessDenied {
  			return Error(403, "Access denied to datasource", err)
  		}
  		return Error(500, "Unable to load datasource meta data", err)
  	}
  
  	request := &tsdb.TsdbQuery{TimeRange: timeRange}
  
  	for _, query := range reqDto.Queries {
  		request.Queries = append(request.Queries, &tsdb.Query{
  			RefId:         query.Get("refId").MustString("A"),
  			MaxDataPoints: query.Get("maxDataPoints").MustInt64(100),
  			IntervalMs:    query.Get("intervalMs").MustInt64(1000),
  			Model:         query,
  			DataSource:    ds,
  		})
  	}
  
  	resp, err := tsdb.HandleRequest(c.Req.Context(), ds, request)
  	if err != nil {
  		return Error(500, "Metric request error", err)
  	}
  
  	statusCode := 200
  	for _, res := range resp.Results {
  		if res.Error != nil {
  			res.ErrorString = res.Error.Error()
  			resp.Message = res.ErrorString
  			statusCode = 400
  		}
  	}
  
  	return JSON(statusCode, &resp)
  }
docs: // POST /api/tsdb/query