Skip to content

List criterion versions

client.Rubrics.Criteria.ListVersions(ctx, rubricCriteriaID, params) (*RubricCriterionListVersionsResponse, error)
GET/v5/rubrics/{rubric_id}/criteria/{rubric_criteria_id}/versions

List the full version history of a single criterion, paginated.

Because criterion updates are append-only, this returns one entry per version, exposing every prior state of the criterion, ordered by version descending (newest first) by default. The request is rejected if the criterion does not belong to the rubric named in the path.

ParametersExpand Collapse
rubricCriteriaID string
params RubricCriterionListVersionsParams
RubricID param.Field[string]

Path param

EndingBefore param.Field[string]Optional

Query param

Limit param.Field[int64]Optional

Query param

maximum10000
minimum1
SortBy param.Field[string]Optional

Query param

SortOrder param.Field[SortOrder]Optional

Query param

StartingAfter param.Field[string]Optional

Query param

ReturnsExpand Collapse
type RubricCriterionListVersionsResponse struct{…}
HasMore bool

Whether there are more items left to be fetched.

ID string
CreatedAt Time
formatdate-time
RubricID string
Title string
Version int64
Annotations map[string, any]Optional
Object RubricCriteriaResponseObjectOptional
Weight float64Optional
Total int64

The total of items that match the query. This is greater than or equal to the number of items returned.

Limit int64Optional

The maximum number of items to return.

Object RubricCriterionListVersionsResponseObjectOptional

List criterion versions

package main

import (
  "context"
  "fmt"

  "github.com/scaleapi/sgp-dev-go"
  "github.com/scaleapi/sgp-dev-go/option"
)

func main() {
  client := sgpdev.NewClient(
    option.WithAPIKey("My API Key"),
    option.WithAccountID("My Account ID"),
  )
  response, err := client.Rubrics.Criteria.ListVersions(
    context.TODO(),
    "rubric_criteria_id",
    sgpdev.RubricCriterionListVersionsParams{
      RubricID: "rubric_id",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.HasMore)
}
{
  "has_more": true,
  "items": [
    {
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "rubric_id": "rubric_id",
      "title": "title",
      "version": 0,
      "annotations": {
        "foo": "bar"
      },
      "object": "rubric_criteria",
      "weight": 0
    }
  ],
  "total": 0,
  "limit": 0,
  "object": "list"
}
Returns Examples
{
  "has_more": true,
  "items": [
    {
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "rubric_id": "rubric_id",
      "title": "title",
      "version": 0,
      "annotations": {
        "foo": "bar"
      },
      "object": "rubric_criteria",
      "weight": 0
    }
  ],
  "total": 0,
  "limit": 0,
  "object": "list"
}