PUT
/
testcases
/
{testcaseId}
import Scorecard from 'scorecard-ai';

const client = new Scorecard({
  bearerToken: process.env['SCORECARD_API_KEY'], // This is the default and can be omitted
});

async function main() {
  const testcase = await client.testcases.update('248', {
    jsonData: {
      question: 'What is the capital of France?',
      idealAnswer: 'Paris is the capital of France',
      provenance: 'hand_curated',
    },
  });

  console.log(testcase.id);
}

main();
{
  "id": "248",
  "testsetId": "246",
  "jsonData": {
    "question": "What is the capital of France?",
    "idealAnswer": "Paris is the capital of France",
    "provenance": "hand_curated"
  },
  "inputs": {
    "question": "What is the capital of France?"
  },
  "labels": {
    "idealAnswer": "Paris is the capital of France"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

testcaseId
string
required

The ID of the Testcase to update.

Example:

"248"

Body

application/json
jsonData
object
required

The JSON data of the Testcase, which is validated against the Testset's schema.

Response

200
application/json
Testcase updated successfully

A test case in the Scorecard system. Contains JSON data that is validated against the schema defined by its Testset. The inputs and labels fields are derived from the data field based on the Testset's fieldMapping, and include all mapped fields, including those with validation errors. Testcases are stored regardless of validation results, with any validation errors included in the validationErrors field.

id
string
required

The ID of the Testcase.

testsetId
string
required

The ID of the Testset this Testcase belongs to.

jsonData
object
required

The JSON data of the Testcase, which is validated against the Testset's schema.

inputs
object
required

Derived from data based on the Testset's fieldMapping. Contains all fields marked as inputs, including those with validation errors.

labels
object
required

Derived from data based on the Testset's fieldMapping. Contains all fields marked as labels, including those with validation errors.

validationErrors
object[]

Validation errors found in the Testcase data. If present, the Testcase doesn't fully conform to its Testset's schema.