Create a test case
Create a new test case
curl --request POST \
--url https://gentrace.ai/api/v4/test-cases \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"datasetId": "b2c3d4e5-f6a7-8901-2345-67890abcdef1",
"name": "Prompting with a SQL query that does not return any results",
"inputs": {
"query": "What is the capital of France?"
},
"expectedOutputs": {
"result": "No results found"
}
}
'import requests
url = "https://gentrace.ai/api/v4/test-cases"
payload = {
"datasetId": "b2c3d4e5-f6a7-8901-2345-67890abcdef1",
"name": "Prompting with a SQL query that does not return any results",
"inputs": { "query": "What is the capital of France?" },
"expectedOutputs": { "result": "No results found" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
datasetId: 'b2c3d4e5-f6a7-8901-2345-67890abcdef1',
name: 'Prompting with a SQL query that does not return any results',
inputs: {query: 'What is the capital of France?'},
expectedOutputs: {result: 'No results found'}
})
};
fetch('https://gentrace.ai/api/v4/test-cases', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://gentrace.ai/api/v4/test-cases",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'datasetId' => 'b2c3d4e5-f6a7-8901-2345-67890abcdef1',
'name' => 'Prompting with a SQL query that does not return any results',
'inputs' => [
'query' => 'What is the capital of France?'
],
'expectedOutputs' => [
'result' => 'No results found'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://gentrace.ai/api/v4/test-cases"
payload := strings.NewReader("{\n \"datasetId\": \"b2c3d4e5-f6a7-8901-2345-67890abcdef1\",\n \"name\": \"Prompting with a SQL query that does not return any results\",\n \"inputs\": {\n \"query\": \"What is the capital of France?\"\n },\n \"expectedOutputs\": {\n \"result\": \"No results found\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://gentrace.ai/api/v4/test-cases")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"datasetId\": \"b2c3d4e5-f6a7-8901-2345-67890abcdef1\",\n \"name\": \"Prompting with a SQL query that does not return any results\",\n \"inputs\": {\n \"query\": \"What is the capital of France?\"\n },\n \"expectedOutputs\": {\n \"result\": \"No results found\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gentrace.ai/api/v4/test-cases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"datasetId\": \"b2c3d4e5-f6a7-8901-2345-67890abcdef1\",\n \"name\": \"Prompting with a SQL query that does not return any results\",\n \"inputs\": {\n \"query\": \"What is the capital of France?\"\n },\n \"expectedOutputs\": {\n \"result\": \"No results found\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"createdAt": "2025-04-01T00:00:00.000Z",
"updatedAt": "2025-04-01T00:00:00.000Z",
"inputs": {
"query": "What is the capital of France?"
},
"expectedOutputs": {
"answer": "Paris"
},
"datasetId": "123e4567-e89b-12d3-a456-426614174000",
"name": "Capital of France query",
"pipelineId": "abcdef12-3456-7890-abcd-ef1234567890",
"archivedAt": "2025-04-01T00:00:00.000Z",
"deletedAt": "2025-04-01T00:00:00.000Z"
}{
"message": "Invalid parameters: 'name' field is required"
}{
"message": "Invalid or expired API key"
}{
"message": "Resource with ID '123e4567-e89b-12d3-a456-426614174000' not found"
}{
"message": "Internal server error occurred while processing the request"
}Authorizations
Enter Gentrace API key (Format: Authorization: Bearer )
Body
Test case creation parameters
Dataset UUID
"b2c3d4e5-f6a7-8901-2345-67890abcdef1"
Test case name
1"Prompting with a SQL query that does not return any results"
Test case inputs as a JSON object
{ "query": "What is the capital of France?" }
Optional expected outputs as a JSON object
{ "result": "No results found" }
Response
Successful response
Test Case UUID
"a1b2c3d4-e5f6-7890-1234-567890abcdef"
Creation timestamp (ISO 8601)
"2025-04-01T00:00:00.000Z"
Last update timestamp (ISO 8601)
"2025-04-01T00:00:00.000Z"
Input data for the test case
{ "query": "What is the capital of France?" }
Expected output data for the test case
{ "answer": "Paris" }
Associated Dataset UUID
"123e4567-e89b-12d3-a456-426614174000"
Test Case name
"Capital of France query"
Associated Pipeline UUID
"abcdef12-3456-7890-abcd-ef1234567890"
Archive timestamp (ISO 8601)
"2025-04-01T00:00:00.000Z"
Deletion timestamp (ISO 8601)
"2025-04-01T00:00:00.000Z"
curl --request POST \
--url https://gentrace.ai/api/v4/test-cases \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"datasetId": "b2c3d4e5-f6a7-8901-2345-67890abcdef1",
"name": "Prompting with a SQL query that does not return any results",
"inputs": {
"query": "What is the capital of France?"
},
"expectedOutputs": {
"result": "No results found"
}
}
'import requests
url = "https://gentrace.ai/api/v4/test-cases"
payload = {
"datasetId": "b2c3d4e5-f6a7-8901-2345-67890abcdef1",
"name": "Prompting with a SQL query that does not return any results",
"inputs": { "query": "What is the capital of France?" },
"expectedOutputs": { "result": "No results found" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
datasetId: 'b2c3d4e5-f6a7-8901-2345-67890abcdef1',
name: 'Prompting with a SQL query that does not return any results',
inputs: {query: 'What is the capital of France?'},
expectedOutputs: {result: 'No results found'}
})
};
fetch('https://gentrace.ai/api/v4/test-cases', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://gentrace.ai/api/v4/test-cases",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'datasetId' => 'b2c3d4e5-f6a7-8901-2345-67890abcdef1',
'name' => 'Prompting with a SQL query that does not return any results',
'inputs' => [
'query' => 'What is the capital of France?'
],
'expectedOutputs' => [
'result' => 'No results found'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://gentrace.ai/api/v4/test-cases"
payload := strings.NewReader("{\n \"datasetId\": \"b2c3d4e5-f6a7-8901-2345-67890abcdef1\",\n \"name\": \"Prompting with a SQL query that does not return any results\",\n \"inputs\": {\n \"query\": \"What is the capital of France?\"\n },\n \"expectedOutputs\": {\n \"result\": \"No results found\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://gentrace.ai/api/v4/test-cases")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"datasetId\": \"b2c3d4e5-f6a7-8901-2345-67890abcdef1\",\n \"name\": \"Prompting with a SQL query that does not return any results\",\n \"inputs\": {\n \"query\": \"What is the capital of France?\"\n },\n \"expectedOutputs\": {\n \"result\": \"No results found\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gentrace.ai/api/v4/test-cases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"datasetId\": \"b2c3d4e5-f6a7-8901-2345-67890abcdef1\",\n \"name\": \"Prompting with a SQL query that does not return any results\",\n \"inputs\": {\n \"query\": \"What is the capital of France?\"\n },\n \"expectedOutputs\": {\n \"result\": \"No results found\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"createdAt": "2025-04-01T00:00:00.000Z",
"updatedAt": "2025-04-01T00:00:00.000Z",
"inputs": {
"query": "What is the capital of France?"
},
"expectedOutputs": {
"answer": "Paris"
},
"datasetId": "123e4567-e89b-12d3-a456-426614174000",
"name": "Capital of France query",
"pipelineId": "abcdef12-3456-7890-abcd-ef1234567890",
"archivedAt": "2025-04-01T00:00:00.000Z",
"deletedAt": "2025-04-01T00:00:00.000Z"
}{
"message": "Invalid parameters: 'name' field is required"
}{
"message": "Invalid or expired API key"
}{
"message": "Resource with ID '123e4567-e89b-12d3-a456-426614174000' not found"
}{
"message": "Internal server error occurred while processing the request"
}