Create a question
curl --request POST \
--url https://api.egp.scale.com/v5/questions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "<string>",
"prompt": "<string>",
"configuration": {
"choices": [
"<string>"
],
"multi": true,
"dropdown": true
},
"conditions": [
{}
],
"question_type": "categorical"
}
'import requests
url = "https://api.egp.scale.com/v5/questions"
payload = {
"name": "<string>",
"prompt": "<string>",
"configuration": {
"choices": ["<string>"],
"multi": True,
"dropdown": True
},
"conditions": [{}],
"question_type": "categorical"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
prompt: '<string>',
configuration: {choices: ['<string>'], multi: true, dropdown: true},
conditions: [{}],
question_type: 'categorical'
})
};
fetch('https://api.egp.scale.com/v5/questions', 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://api.egp.scale.com/v5/questions",
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([
'name' => '<string>',
'prompt' => '<string>',
'configuration' => [
'choices' => [
'<string>'
],
'multi' => true,
'dropdown' => true
],
'conditions' => [
[
]
],
'question_type' => 'categorical'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://api.egp.scale.com/v5/questions"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"configuration\": {\n \"choices\": [\n \"<string>\"\n ],\n \"multi\": true,\n \"dropdown\": true\n },\n \"conditions\": [\n {}\n ],\n \"question_type\": \"categorical\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://api.egp.scale.com/v5/questions")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"configuration\": {\n \"choices\": [\n \"<string>\"\n ],\n \"multi\": true,\n \"dropdown\": true\n },\n \"conditions\": [\n {}\n ],\n \"question_type\": \"categorical\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v5/questions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"configuration\": {\n \"choices\": [\n \"<string>\"\n ],\n \"multi\": true,\n \"dropdown\": true\n },\n \"conditions\": [\n {}\n ],\n \"question_type\": \"categorical\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"created_by": {
"id": "<string>",
"type": "user",
"object": "identity"
},
"created_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"prompt": "<string>",
"configuration": {
"choices": [
"<string>"
],
"multi": true,
"dropdown": true
},
"object": "question",
"conditions": [
{}
],
"archived_at": "2023-11-07T05:31:56Z",
"question_type": "categorical"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Questions
Create a question
Create a new question owned by the caller’s account.
The question is one of six types selected by the required question_type
discriminator (categorical, rating, number, free_text, form, or timestamp),
and each type carries its own configuration block; name and prompt
are required for every type. Questions are the reusable units that are grouped
into question sets and referenced by rubrics, so create them before assembling
a question set. The created question is scoped to the caller’s account and
records the creating identity. The question type and its configuration are set
at creation time and cannot be changed afterward through the update endpoint.
POST
/
v5
/
questions
Create a question
curl --request POST \
--url https://api.egp.scale.com/v5/questions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "<string>",
"prompt": "<string>",
"configuration": {
"choices": [
"<string>"
],
"multi": true,
"dropdown": true
},
"conditions": [
{}
],
"question_type": "categorical"
}
'import requests
url = "https://api.egp.scale.com/v5/questions"
payload = {
"name": "<string>",
"prompt": "<string>",
"configuration": {
"choices": ["<string>"],
"multi": True,
"dropdown": True
},
"conditions": [{}],
"question_type": "categorical"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
prompt: '<string>',
configuration: {choices: ['<string>'], multi: true, dropdown: true},
conditions: [{}],
question_type: 'categorical'
})
};
fetch('https://api.egp.scale.com/v5/questions', 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://api.egp.scale.com/v5/questions",
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([
'name' => '<string>',
'prompt' => '<string>',
'configuration' => [
'choices' => [
'<string>'
],
'multi' => true,
'dropdown' => true
],
'conditions' => [
[
]
],
'question_type' => 'categorical'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://api.egp.scale.com/v5/questions"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"configuration\": {\n \"choices\": [\n \"<string>\"\n ],\n \"multi\": true,\n \"dropdown\": true\n },\n \"conditions\": [\n {}\n ],\n \"question_type\": \"categorical\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://api.egp.scale.com/v5/questions")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"configuration\": {\n \"choices\": [\n \"<string>\"\n ],\n \"multi\": true,\n \"dropdown\": true\n },\n \"conditions\": [\n {}\n ],\n \"question_type\": \"categorical\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v5/questions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"configuration\": {\n \"choices\": [\n \"<string>\"\n ],\n \"multi\": true,\n \"dropdown\": true\n },\n \"conditions\": [\n {}\n ],\n \"question_type\": \"categorical\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"created_by": {
"id": "<string>",
"type": "user",
"object": "identity"
},
"created_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"prompt": "<string>",
"configuration": {
"choices": [
"<string>"
],
"multi": true,
"dropdown": true
},
"object": "question",
"conditions": [
{}
],
"archived_at": "2023-11-07T05:31:56Z",
"question_type": "categorical"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Body
application/json
- CategoricalQuestionRequest
- RatingQuestionRequest
- NumberQuestionRequest
- FreeTextQuestionRequest
- FormQuestionRequest
- TimestampQuestionRequest
Response
Successful Response
- Question
- Question
- Question
- Question
- Question
- Question

