Launch Week 02 wrapped — explore all five launches

Test Code

POSThttps://api.confident-ai.com/v2/transformers/{transformerId}/test-code

Runs the transformer's stored code against a sample value and returns what it produced. Code that raises or times out is a completed test, so it comes back with a 200 and success: false carrying error and reason — branch on success rather than on the status. A 404 means the transformer does not exist in this project, and a 400 means it has no code saved to run.

POST/v2/transformers/{transformerId}/test-code
curl -X POST "https://api.confident-ai.com/v2/transformers/{transformerId}/test-code" \
  -H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
  -H "Content-Type: application/json" \
  -d '{
  "inputData": {
    "data": {
      "answer": "Mount Everest is 8,849 metres tall."
    }
  }
}'
200
{
  "success": true,
  "data": {
    "success": true,
    "output": "Mount Everest is 8,849 metres tall.",
    "verboseLogs": null
  },
  "deprecated": false
}

Headers

  • CONFIDENT_API_KEYstringRequired

    The API key of your Confident AI project.

Path parameters

  • transformerIdstringRequired

    The id of the transformer.

Request body

  • inputDataany

    The value to pass to the transformer's transform function. Any JSON value is accepted; send the shape the transformer expects to see in production.

Response

Test Code succeeded.

  • successboolean

    Indicates if the request was successful.

  • dataobject | object

    What running the transformer's code against your sample produced. Branch on success: the code raising is reported here, not as an error status.

    Show 2 variantsHide 2 variants
    • Transformer Code Run Successobject

      A run of the transformer's code that returned a value.

      Show 3 propertiesHide 3 properties
      • successenum

        Marks the run as successful.

        Show 1 enum valueHide 1 enum value
        • true
      • outputany

        The value the transformer returned. Any JSON value.

      • verboseLogsstring | null

    • OR
    • Transformer Code Run Failureobject

      A run of the transformer's code that raised or timed out. Code that fails is still a completed test, so this is returned with a 200; branch on success.

      Show 4 propertiesHide 4 properties
      • successenum

        Marks the run as failed.

        Show 1 enum valueHide 1 enum value
        • false
      • errorstring | null

      • reasonstring | null

      • verboseLogsstring | null

  • deprecatedboolean

    Indicates if this endpoint is deprecated.

Built byConfident AI