diff --git a/http/proto.go b/http/proto.go index b63eb5b8fb..49b371d21f 100644 --- a/http/proto.go +++ b/http/proto.go @@ -122,6 +122,7 @@ func (h *ProtoHandler) handleGetProtos(w http.ResponseWriter, r *http.Request) { type createProtoResourcesRequest struct { ProtoID platform.ID `json:"-"` OrganizationID platform.ID `json:"orgID"` + opts platform.FindOptions } // Decode turns an http request into a createProtoResourceRequest. @@ -132,6 +133,12 @@ func (r *createProtoResourcesRequest) Decode(req *http.Request) error { return err } + opts, err := decodeFindOptions(ctx, req) + if err != nil { + return err + } + r.opts = *opts + r.ProtoID = id if err := json.NewDecoder(req.Body).Decode(r); err != nil { @@ -157,7 +164,7 @@ func (h *ProtoHandler) handlePostProtosDashboards(w http.ResponseWriter, r *http } filter := platform.DashboardFilter{OrganizationID: &req.OrganizationID} - if err := encodeResponse(ctx, w, http.StatusCreated, newGetDashboardsResponse(ctx, ds, filter, h.LabelService)); err != nil { + if err := encodeResponse(ctx, w, http.StatusCreated, newGetDashboardsResponse(ctx, ds, filter, req.opts, h.LabelService)); err != nil { logEncodingError(h.Logger, r, err) return } diff --git a/http/proto_test.go b/http/proto_test.go index 785bf847e6..a1f9fb79fd 100644 --- a/http/proto_test.go +++ b/http/proto_test.go @@ -197,7 +197,7 @@ func TestProtoHandler(t *testing.T) { } ], "links": { - "self": "/api/v2/dashboards?orgID=0000000000000001" + "self": "/api/v2/dashboards?descending=false&limit=20&offset=0&orgID=0000000000000001" } } `,