Skip to content

Create a rubric

client.Rubrics.New(ctx, body) (*RubricResponse, error)
POST/v5/rubrics

Create a rubric, optionally with its initial criteria in the same request.

The rubric is created for the caller’s account at version 1. If the optional criteria field is supplied it must contain at least one entry, and each entry is created as a criterion attached to the new rubric; omit it to create an empty rubric and add criteria later via the criteria endpoint. The response returns the created rubric together with the full detail of any criteria created in this call.

ParametersExpand Collapse
body RubricNewParams
Title param.Field[string]

The rubric title

minLength1
Criteria param.Field[[]RubricCriteriaInput]Optional

Initial criteria to create with the rubric

Title string

The Criteria text

minLength1
Annotations map[string, any]Optional

Free-form metadata for the Criteria

Weight float64Optional

Weight multiplier for scoring

minimum0
Tags param.Field[[]string]Optional

The tags associated with the entity

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

Create 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.New(context.TODO(), sgpdev.RubricNewParams{
    Title: "x",
  })
  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"
}