Skip to content

Update a criterion

client.Rubrics.Criteria.Update(ctx, rubricCriteriaID, params) (*RubricCriteriaResponse, error)
PATCH/v5/rubrics/{rubric_id}/criteria/{rubric_criteria_id}

Apply a partial update to a criterion, creating a new version.

Updates are append-only: rather than overwriting the criterion in place, each update inserts a new immutable version with an incremented version number, so every prior state stays available through the versions endpoint. Fields not supplied are carried forward from the current version. The request is rejected if the criterion does not belong to the rubric named in the path.

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

Path param

Annotations param.Field[map[string, any]]Optional

Body param: Free-form metadata for the Criteria

Title param.Field[string]Optional

Body param: The Criteria text

minLength1
Weight param.Field[float64]Optional

Body param: Weight multiplier for scoring

minimum0
ReturnsExpand Collapse
type RubricCriteriaResponse struct{…}
ID string
CreatedAt Time
formatdate-time
RubricID string
Title string
Version int64
Annotations map[string, any]Optional
Object RubricCriteriaResponseObjectOptional
Weight float64Optional

Update a criterion

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"),
  )
  rubricCriteriaResponse, err := client.Rubrics.Criteria.Update(
    context.TODO(),
    "rubric_criteria_id",
    sgpdev.RubricCriterionUpdateParams{
      RubricID: "rubric_id",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", rubricCriteriaResponse.ID)
}
{
  "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
}
Returns Examples
{
  "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
}