Submit assessment for headless grading
curl --request POST \
--url https://edpire.com/api/v1/assessments/{id}/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"learner_ref": "<string>",
"answers": {
"exerciseAnswers": [
{
"exerciseId": "<string>",
"questionAnswers": [
{
"questionId": "<string>",
"answers": [
{}
]
}
]
}
]
},
"allow_draft": false,
"metadata": {}
}
'import requests
url = "https://edpire.com/api/v1/assessments/{id}/submit"
payload = {
"learner_ref": "<string>",
"answers": { "exerciseAnswers": [
{
"exerciseId": "<string>",
"questionAnswers": [
{
"questionId": "<string>",
"answers": [{}]
}
]
}
] },
"allow_draft": False,
"metadata": {}
}
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({
learner_ref: '<string>',
answers: {
exerciseAnswers: [
{
exerciseId: '<string>',
questionAnswers: [{questionId: '<string>', answers: [{}]}]
}
]
},
allow_draft: false,
metadata: {}
})
};
fetch('https://edpire.com/api/v1/assessments/{id}/submit', 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://edpire.com/api/v1/assessments/{id}/submit",
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([
'learner_ref' => '<string>',
'answers' => [
'exerciseAnswers' => [
[
'exerciseId' => '<string>',
'questionAnswers' => [
[
'questionId' => '<string>',
'answers' => [
[
]
]
]
]
]
]
],
'allow_draft' => false,
'metadata' => [
]
]),
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://edpire.com/api/v1/assessments/{id}/submit"
payload := strings.NewReader("{\n \"learner_ref\": \"<string>\",\n \"answers\": {\n \"exerciseAnswers\": [\n {\n \"exerciseId\": \"<string>\",\n \"questionAnswers\": [\n {\n \"questionId\": \"<string>\",\n \"answers\": [\n {}\n ]\n }\n ]\n }\n ]\n },\n \"allow_draft\": false,\n \"metadata\": {}\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://edpire.com/api/v1/assessments/{id}/submit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"learner_ref\": \"<string>\",\n \"answers\": {\n \"exerciseAnswers\": [\n {\n \"exerciseId\": \"<string>\",\n \"questionAnswers\": [\n {\n \"questionId\": \"<string>\",\n \"answers\": [\n {}\n ]\n }\n ]\n }\n ]\n },\n \"allow_draft\": false,\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://edpire.com/api/v1/assessments/{id}/submit")
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 \"learner_ref\": \"<string>\",\n \"answers\": {\n \"exerciseAnswers\": [\n {\n \"exerciseId\": \"<string>\",\n \"questionAnswers\": [\n {\n \"questionId\": \"<string>\",\n \"answers\": [\n {}\n ]\n }\n ]\n }\n ]\n },\n \"allow_draft\": false,\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"submission_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"score": 123,
"max_score": 123,
"percentage": 123,
"passed": true,
"passing_score_percent": 123,
"attempt_number": 123,
"exercise_results": [
{
"exercise_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"total_score": 123,
"max_score": 123,
"question_results": [
{
"question_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"score": 123,
"max_score": 123,
"correct": true,
"points": 123,
"feedback": {}
}
]
}
]
},
"error": {
"message": "<string>"
},
"meta": {}
}{
"data": null,
"error": {
"message": "<string>"
},
"meta": null
}{
"data": null,
"error": {
"message": "<string>"
},
"meta": null
}{
"data": null,
"error": {
"message": "<string>"
},
"meta": null
}{
"data": null,
"error": {
"message": "<string>"
},
"meta": null
}Assessments
Submit Assessment (Headless)
Submits a full set of answers for server-side grading.
Creates a submission record and returns graded results synchronously.
Fires submission.graded webhook with source: "api".
POST
/
assessments
/
{id}
/
submit
Submit assessment for headless grading
curl --request POST \
--url https://edpire.com/api/v1/assessments/{id}/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"learner_ref": "<string>",
"answers": {
"exerciseAnswers": [
{
"exerciseId": "<string>",
"questionAnswers": [
{
"questionId": "<string>",
"answers": [
{}
]
}
]
}
]
},
"allow_draft": false,
"metadata": {}
}
'import requests
url = "https://edpire.com/api/v1/assessments/{id}/submit"
payload = {
"learner_ref": "<string>",
"answers": { "exerciseAnswers": [
{
"exerciseId": "<string>",
"questionAnswers": [
{
"questionId": "<string>",
"answers": [{}]
}
]
}
] },
"allow_draft": False,
"metadata": {}
}
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({
learner_ref: '<string>',
answers: {
exerciseAnswers: [
{
exerciseId: '<string>',
questionAnswers: [{questionId: '<string>', answers: [{}]}]
}
]
},
allow_draft: false,
metadata: {}
})
};
fetch('https://edpire.com/api/v1/assessments/{id}/submit', 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://edpire.com/api/v1/assessments/{id}/submit",
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([
'learner_ref' => '<string>',
'answers' => [
'exerciseAnswers' => [
[
'exerciseId' => '<string>',
'questionAnswers' => [
[
'questionId' => '<string>',
'answers' => [
[
]
]
]
]
]
]
],
'allow_draft' => false,
'metadata' => [
]
]),
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://edpire.com/api/v1/assessments/{id}/submit"
payload := strings.NewReader("{\n \"learner_ref\": \"<string>\",\n \"answers\": {\n \"exerciseAnswers\": [\n {\n \"exerciseId\": \"<string>\",\n \"questionAnswers\": [\n {\n \"questionId\": \"<string>\",\n \"answers\": [\n {}\n ]\n }\n ]\n }\n ]\n },\n \"allow_draft\": false,\n \"metadata\": {}\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://edpire.com/api/v1/assessments/{id}/submit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"learner_ref\": \"<string>\",\n \"answers\": {\n \"exerciseAnswers\": [\n {\n \"exerciseId\": \"<string>\",\n \"questionAnswers\": [\n {\n \"questionId\": \"<string>\",\n \"answers\": [\n {}\n ]\n }\n ]\n }\n ]\n },\n \"allow_draft\": false,\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://edpire.com/api/v1/assessments/{id}/submit")
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 \"learner_ref\": \"<string>\",\n \"answers\": {\n \"exerciseAnswers\": [\n {\n \"exerciseId\": \"<string>\",\n \"questionAnswers\": [\n {\n \"questionId\": \"<string>\",\n \"answers\": [\n {}\n ]\n }\n ]\n }\n ]\n },\n \"allow_draft\": false,\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"submission_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"score": 123,
"max_score": 123,
"percentage": 123,
"passed": true,
"passing_score_percent": 123,
"attempt_number": 123,
"exercise_results": [
{
"exercise_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"total_score": 123,
"max_score": 123,
"question_results": [
{
"question_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"score": 123,
"max_score": 123,
"correct": true,
"points": 123,
"feedback": {}
}
]
}
]
},
"error": {
"message": "<string>"
},
"meta": {}
}{
"data": null,
"error": {
"message": "<string>"
},
"meta": null
}{
"data": null,
"error": {
"message": "<string>"
},
"meta": null
}{
"data": null,
"error": {
"message": "<string>"
},
"meta": null
}{
"data": null,
"error": {
"message": "<string>"
},
"meta": null
}Authorizations
API key starting with edp_live_. Pass via Authorization: Bearer edp_live_xxx.
Scopes: read:assessments, write:assessments, read:results, write:submissions.
Path Parameters
Assessment UUID
Body
application/json
⌘I