Skip to content

Update or restore a rubric

client.Rubrics.Update(ctx, rubricID, body) (*RubricResponse, error)
PATCH/v5/rubrics/{rubric_id}

Update a rubric’s fields, or restore a previously archived rubric.

The request body is a discriminated union. Send {"restore": true} to restore an archived rubric (clearing its archived state); send any other field set (such as title or tags) to update those fields, carrying forward any field not supplied. Both paths are append-only and produce a new version of the rubric rather than mutating the existing row. Updating the fields of an archived rubric is rejected — restore it first. Restoring a rubric that is not archived is a no-op that returns it unchanged without creating a new version.

ParametersExpand Collapse
rubricID string
body RubricUpdateParams
Rubric param.Field[RubricUpdateParamsRubricUnion]
type RubricUpdateParamsRubricPartialRubricRequestBase struct{…}
Tags []stringOptional

The tags associated with the entity

Title stringOptional

The rubric title

minLength1
type RestoreRequestParam struct{…}
Restore bool

Set to true to restore the entity from the database.

ReturnsExpand Collapse
type RubricResponse struct{…}
ID string
CreatedAt Time
formatdate-time
CreatedBy Identity

The identity that created the entity.

ID string
Type IdentityType
One of the following:
const IdentityTypeUser IdentityType = "user"
const IdentityTypeServiceAccount IdentityType = "service_account"
Object IdentityObjectOptional
Tags []string

The tags associated with the entity

Title string
Version int64
ArchivedAt TimeOptional
formatdate-time
Criteria []RubricResponseCriterionUnionOptional

Full criteria on get, summary (title + weight) on list

One of the following:
type RubricCriteriaResponse struct{…}
ID string
CreatedAt Time
formatdate-time
RubricID string
Title string
Version int64
Annotations map[string, any]Optional
Object RubricCriteriaResponseObjectOptional
Weight float64Optional
type RubricCriteriaSummaryResponse struct{…}

Slim criteria projection for list endpoints (title + weight only).

Title string
Weight float64Optional
Object RubricResponseObjectOptional
UpdatedAt TimeOptional
formatdate-time

Update or restore a rubric

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"),
  )
  rubricResponse, err := client.Rubrics.Update(
    context.TODO(),
    "rubric_id",
    sgpdev.RubricUpdateParams{
      OfPartialRubricRequestBase: &sgpdev.RubricUpdateParamsRubricPartialRubricRequestBase{

      },
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", rubricResponse.ID)
}
{
  "id": "id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "created_by": {
    "id": "id",
    "type": "user",
    "object": "identity"
  },
  "tags": [
    "string"
  ],
  "title": "title",
  "version": 0,
  "archived_at": "2019-12-27T18:11:19.117Z",
  "criteria": [
    {
      "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
    }
  ],
  "object": "rubric",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
Returns Examples
{
  "id": "id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "created_by": {
    "id": "id",
    "type": "user",
    "object": "identity"
  },
  "tags": [
    "string"
  ],
  "title": "title",
  "version": 0,
  "archived_at": "2019-12-27T18:11:19.117Z",
  "criteria": [
    {
      "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
    }
  ],
  "object": "rubric",
  "updated_at": "2019-12-27T18:11:19.117Z"
}