Duplicate a Lesson
curl --request POST \
--url https://schoolmaker.co/api/v1/lessons/{id}/duplicate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"destination_section_id": "section_id",
"name": "Copied lesson",
"idempotency_key": "lesson-import-copy-1"
}
'import requests
url = "https://schoolmaker.co/api/v1/lessons/{id}/duplicate"
payload = {
"destination_section_id": "section_id",
"name": "Copied lesson",
"idempotency_key": "lesson-import-copy-1"
}
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({
destination_section_id: 'section_id',
name: 'Copied lesson',
idempotency_key: 'lesson-import-copy-1'
})
};
fetch('https://schoolmaker.co/api/v1/lessons/{id}/duplicate', 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://schoolmaker.co/api/v1/lessons/{id}/duplicate",
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([
'destination_section_id' => 'section_id',
'name' => 'Copied lesson',
'idempotency_key' => 'lesson-import-copy-1'
]),
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://schoolmaker.co/api/v1/lessons/{id}/duplicate"
payload := strings.NewReader("{\n \"destination_section_id\": \"section_id\",\n \"name\": \"Copied lesson\",\n \"idempotency_key\": \"lesson-import-copy-1\"\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://schoolmaker.co/api/v1/lessons/{id}/duplicate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"destination_section_id\": \"section_id\",\n \"name\": \"Copied lesson\",\n \"idempotency_key\": \"lesson-import-copy-1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://schoolmaker.co/api/v1/lessons/{id}/duplicate")
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 \"destination_section_id\": \"section_id\",\n \"name\": \"Copied lesson\",\n \"idempotency_key\": \"lesson-import-copy-1\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"operation": "duplicate_lesson",
"status": "pending",
"result": {},
"error": "<string>"
}{
"id": "operation_id",
"operation": "duplicate_lesson",
"status": "pending",
"result": null,
"error": null
}{
"error": "Access denied"
}{
"error": "Access denied"
}{
"error": "Record not found"
}{
"error": "Invalid arguments: /attributes/drip_delay integer"
}Lessons
Duplicate a Lesson
Duplicates a lesson in the selected section and leaves the copy unpublished. The copy keeps its content, media and steps. Returns a background operation. Check its status until completed or failed.
POST
/
lessons
/
{id}
/
duplicate
Duplicate a Lesson
curl --request POST \
--url https://schoolmaker.co/api/v1/lessons/{id}/duplicate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"destination_section_id": "section_id",
"name": "Copied lesson",
"idempotency_key": "lesson-import-copy-1"
}
'import requests
url = "https://schoolmaker.co/api/v1/lessons/{id}/duplicate"
payload = {
"destination_section_id": "section_id",
"name": "Copied lesson",
"idempotency_key": "lesson-import-copy-1"
}
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({
destination_section_id: 'section_id',
name: 'Copied lesson',
idempotency_key: 'lesson-import-copy-1'
})
};
fetch('https://schoolmaker.co/api/v1/lessons/{id}/duplicate', 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://schoolmaker.co/api/v1/lessons/{id}/duplicate",
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([
'destination_section_id' => 'section_id',
'name' => 'Copied lesson',
'idempotency_key' => 'lesson-import-copy-1'
]),
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://schoolmaker.co/api/v1/lessons/{id}/duplicate"
payload := strings.NewReader("{\n \"destination_section_id\": \"section_id\",\n \"name\": \"Copied lesson\",\n \"idempotency_key\": \"lesson-import-copy-1\"\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://schoolmaker.co/api/v1/lessons/{id}/duplicate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"destination_section_id\": \"section_id\",\n \"name\": \"Copied lesson\",\n \"idempotency_key\": \"lesson-import-copy-1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://schoolmaker.co/api/v1/lessons/{id}/duplicate")
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 \"destination_section_id\": \"section_id\",\n \"name\": \"Copied lesson\",\n \"idempotency_key\": \"lesson-import-copy-1\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"operation": "duplicate_lesson",
"status": "pending",
"result": {},
"error": "<string>"
}{
"id": "operation_id",
"operation": "duplicate_lesson",
"status": "pending",
"result": null,
"error": null
}{
"error": "Access denied"
}{
"error": "Access denied"
}{
"error": "Record not found"
}{
"error": "Invalid arguments: /attributes/drip_delay integer"
}Authorizations
Body
application/json
Response
Existing duplication request. Check its status.
Was this page helpful?