Assign scenario to user
curl --request POST \
--url https://api.exec.com/rest/v1/scenarios/{scenario_id}/assignments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user_email": "[email protected]",
"due_date": "2024-03-15T17:00:00Z",
"assigner_email": "[email protected]",
"attempt_min": 1,
"attempt_max": 5,
"rank_min": "silver",
"custom_message": "Please complete this discovery call practice by Friday"
}
'import requests
url = "https://api.exec.com/rest/v1/scenarios/{scenario_id}/assignments"
payload = {
"user_email": "[email protected]",
"due_date": "2024-03-15T17:00:00Z",
"assigner_email": "[email protected]",
"attempt_min": 1,
"attempt_max": 5,
"rank_min": "silver",
"custom_message": "Please complete this discovery call practice by Friday"
}
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({
user_email: '[email protected]',
due_date: '2024-03-15T17:00:00Z',
assigner_email: '[email protected]',
attempt_min: 1,
attempt_max: 5,
rank_min: 'silver',
custom_message: 'Please complete this discovery call practice by Friday'
})
};
fetch('https://api.exec.com/rest/v1/scenarios/{scenario_id}/assignments', 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.exec.com/rest/v1/scenarios/{scenario_id}/assignments",
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([
'user_email' => '[email protected]',
'due_date' => '2024-03-15T17:00:00Z',
'assigner_email' => '[email protected]',
'attempt_min' => 1,
'attempt_max' => 5,
'rank_min' => 'silver',
'custom_message' => 'Please complete this discovery call practice by Friday'
]),
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://api.exec.com/rest/v1/scenarios/{scenario_id}/assignments"
payload := strings.NewReader("{\n \"user_email\": \"[email protected]\",\n \"due_date\": \"2024-03-15T17:00:00Z\",\n \"assigner_email\": \"[email protected]\",\n \"attempt_min\": 1,\n \"attempt_max\": 5,\n \"rank_min\": \"silver\",\n \"custom_message\": \"Please complete this discovery call practice by Friday\"\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://api.exec.com/rest/v1/scenarios/{scenario_id}/assignments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_email\": \"[email protected]\",\n \"due_date\": \"2024-03-15T17:00:00Z\",\n \"assigner_email\": \"[email protected]\",\n \"attempt_min\": 1,\n \"attempt_max\": 5,\n \"rank_min\": \"silver\",\n \"custom_message\": \"Please complete this discovery call practice by Friday\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exec.com/rest/v1/scenarios/{scenario_id}/assignments")
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 \"user_email\": \"[email protected]\",\n \"due_date\": \"2024-03-15T17:00:00Z\",\n \"assigner_email\": \"[email protected]\",\n \"attempt_min\": 1,\n \"attempt_max\": 5,\n \"rank_min\": \"silver\",\n \"custom_message\": \"Please complete this discovery call practice by Friday\"\n}"
response = http.request(request)
puts response.read_body{
"id": "a1s2s3i4g5n6",
"user": {
"id": "u1a2b3c4d5e6",
"email": "[email protected]",
"first_name": "Jane",
"last_name": "Smith"
},
"scenario": {
"id": "s1c2e3n4a5r6",
"name": "Discovery Call",
"slug": "discovery-call"
},
"status": "not_started",
"due_date": "2024-03-15T17:00:00Z",
"best_score": null,
"best_rank": null,
"attempt_count": 0,
"attempt_min": 1,
"attempt_max": 5,
"rank_min": "silver",
"program": null,
"created_at": "2024-03-01T10:00:00Z"
}{
"error": {
"type": "invalid_request",
"code": "invalid_pagination",
"message": "Invalid pagination parameters"
}
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "Invalid or inactive API key"
}
}{
"error": {
"type": "not_found",
"message": "Scenario not found: abc123"
}
}Scenarios
Assign scenario to user
Assign a scenario to a user as a task or homework assignment. The user will receive notification of the assignment and can track their progress.
POST
/
scenarios
/
{scenario_id}
/
assignments
Assign scenario to user
curl --request POST \
--url https://api.exec.com/rest/v1/scenarios/{scenario_id}/assignments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user_email": "[email protected]",
"due_date": "2024-03-15T17:00:00Z",
"assigner_email": "[email protected]",
"attempt_min": 1,
"attempt_max": 5,
"rank_min": "silver",
"custom_message": "Please complete this discovery call practice by Friday"
}
'import requests
url = "https://api.exec.com/rest/v1/scenarios/{scenario_id}/assignments"
payload = {
"user_email": "[email protected]",
"due_date": "2024-03-15T17:00:00Z",
"assigner_email": "[email protected]",
"attempt_min": 1,
"attempt_max": 5,
"rank_min": "silver",
"custom_message": "Please complete this discovery call practice by Friday"
}
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({
user_email: '[email protected]',
due_date: '2024-03-15T17:00:00Z',
assigner_email: '[email protected]',
attempt_min: 1,
attempt_max: 5,
rank_min: 'silver',
custom_message: 'Please complete this discovery call practice by Friday'
})
};
fetch('https://api.exec.com/rest/v1/scenarios/{scenario_id}/assignments', 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.exec.com/rest/v1/scenarios/{scenario_id}/assignments",
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([
'user_email' => '[email protected]',
'due_date' => '2024-03-15T17:00:00Z',
'assigner_email' => '[email protected]',
'attempt_min' => 1,
'attempt_max' => 5,
'rank_min' => 'silver',
'custom_message' => 'Please complete this discovery call practice by Friday'
]),
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://api.exec.com/rest/v1/scenarios/{scenario_id}/assignments"
payload := strings.NewReader("{\n \"user_email\": \"[email protected]\",\n \"due_date\": \"2024-03-15T17:00:00Z\",\n \"assigner_email\": \"[email protected]\",\n \"attempt_min\": 1,\n \"attempt_max\": 5,\n \"rank_min\": \"silver\",\n \"custom_message\": \"Please complete this discovery call practice by Friday\"\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://api.exec.com/rest/v1/scenarios/{scenario_id}/assignments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_email\": \"[email protected]\",\n \"due_date\": \"2024-03-15T17:00:00Z\",\n \"assigner_email\": \"[email protected]\",\n \"attempt_min\": 1,\n \"attempt_max\": 5,\n \"rank_min\": \"silver\",\n \"custom_message\": \"Please complete this discovery call practice by Friday\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exec.com/rest/v1/scenarios/{scenario_id}/assignments")
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 \"user_email\": \"[email protected]\",\n \"due_date\": \"2024-03-15T17:00:00Z\",\n \"assigner_email\": \"[email protected]\",\n \"attempt_min\": 1,\n \"attempt_max\": 5,\n \"rank_min\": \"silver\",\n \"custom_message\": \"Please complete this discovery call practice by Friday\"\n}"
response = http.request(request)
puts response.read_body{
"id": "a1s2s3i4g5n6",
"user": {
"id": "u1a2b3c4d5e6",
"email": "[email protected]",
"first_name": "Jane",
"last_name": "Smith"
},
"scenario": {
"id": "s1c2e3n4a5r6",
"name": "Discovery Call",
"slug": "discovery-call"
},
"status": "not_started",
"due_date": "2024-03-15T17:00:00Z",
"best_score": null,
"best_rank": null,
"attempt_count": 0,
"attempt_min": 1,
"attempt_max": 5,
"rank_min": "silver",
"program": null,
"created_at": "2024-03-01T10:00:00Z"
}{
"error": {
"type": "invalid_request",
"code": "invalid_pagination",
"message": "Invalid pagination parameters"
}
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "Invalid or inactive API key"
}
}{
"error": {
"type": "not_found",
"message": "Scenario not found: abc123"
}
}Authorizations
Body
application/json
Response
Assignment created successfully
A scenario assignment given to a user as a practice task.