レッスン更新
curl --request PATCH \
--url https://api.utage-system.com/v1/members/{site_id}/courses/{course_id}/lessons/{lesson_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"lesson_group_id": "<string>",
"type": "html",
"elements": [
{
"type": "<string>",
"element_id": 123,
"children": [
{}
]
}
],
"is_published": true,
"show_title": true,
"width": 123,
"background_color": "<string>",
"use_comment": true,
"is_comment_override": true,
"comment_text": "<string>",
"comment_show_type": "<string>",
"hide_comment_posted_at": true,
"comment_default_value": "<string>",
"has_target_persons": true,
"target_persons_date_from": "2023-12-25",
"target_persons_date_to": "2023-12-25",
"release_type": "<string>",
"release_day": 4999,
"release_month": 4999,
"release_date": "2023-12-25",
"release_hour": 11,
"js_head": "<string>",
"js_body_top": "<string>",
"js_body": "<string>",
"css": "<string>"
}
'import requests
url = "https://api.utage-system.com/v1/members/{site_id}/courses/{course_id}/lessons/{lesson_id}"
payload = {
"name": "<string>",
"lesson_group_id": "<string>",
"type": "html",
"elements": [
{
"type": "<string>",
"element_id": 123,
"children": [{}]
}
],
"is_published": True,
"show_title": True,
"width": 123,
"background_color": "<string>",
"use_comment": True,
"is_comment_override": True,
"comment_text": "<string>",
"comment_show_type": "<string>",
"hide_comment_posted_at": True,
"comment_default_value": "<string>",
"has_target_persons": True,
"target_persons_date_from": "2023-12-25",
"target_persons_date_to": "2023-12-25",
"release_type": "<string>",
"release_day": 4999,
"release_month": 4999,
"release_date": "2023-12-25",
"release_hour": 11,
"js_head": "<string>",
"js_body_top": "<string>",
"js_body": "<string>",
"css": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
lesson_group_id: '<string>',
type: 'html',
elements: [{type: '<string>', element_id: 123, children: [{}]}],
is_published: true,
show_title: true,
width: 123,
background_color: '<string>',
use_comment: true,
is_comment_override: true,
comment_text: '<string>',
comment_show_type: '<string>',
hide_comment_posted_at: true,
comment_default_value: '<string>',
has_target_persons: true,
target_persons_date_from: '2023-12-25',
target_persons_date_to: '2023-12-25',
release_type: '<string>',
release_day: 4999,
release_month: 4999,
release_date: '2023-12-25',
release_hour: 11,
js_head: '<string>',
js_body_top: '<string>',
js_body: '<string>',
css: '<string>'
})
};
fetch('https://api.utage-system.com/v1/members/{site_id}/courses/{course_id}/lessons/{lesson_id}', 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.utage-system.com/v1/members/{site_id}/courses/{course_id}/lessons/{lesson_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'lesson_group_id' => '<string>',
'type' => 'html',
'elements' => [
[
'type' => '<string>',
'element_id' => 123,
'children' => [
[
]
]
]
],
'is_published' => true,
'show_title' => true,
'width' => 123,
'background_color' => '<string>',
'use_comment' => true,
'is_comment_override' => true,
'comment_text' => '<string>',
'comment_show_type' => '<string>',
'hide_comment_posted_at' => true,
'comment_default_value' => '<string>',
'has_target_persons' => true,
'target_persons_date_from' => '2023-12-25',
'target_persons_date_to' => '2023-12-25',
'release_type' => '<string>',
'release_day' => 4999,
'release_month' => 4999,
'release_date' => '2023-12-25',
'release_hour' => 11,
'js_head' => '<string>',
'js_body_top' => '<string>',
'js_body' => '<string>',
'css' => '<string>'
]),
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.utage-system.com/v1/members/{site_id}/courses/{course_id}/lessons/{lesson_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"lesson_group_id\": \"<string>\",\n \"type\": \"html\",\n \"elements\": [\n {\n \"type\": \"<string>\",\n \"element_id\": 123,\n \"children\": [\n {}\n ]\n }\n ],\n \"is_published\": true,\n \"show_title\": true,\n \"width\": 123,\n \"background_color\": \"<string>\",\n \"use_comment\": true,\n \"is_comment_override\": true,\n \"comment_text\": \"<string>\",\n \"comment_show_type\": \"<string>\",\n \"hide_comment_posted_at\": true,\n \"comment_default_value\": \"<string>\",\n \"has_target_persons\": true,\n \"target_persons_date_from\": \"2023-12-25\",\n \"target_persons_date_to\": \"2023-12-25\",\n \"release_type\": \"<string>\",\n \"release_day\": 4999,\n \"release_month\": 4999,\n \"release_date\": \"2023-12-25\",\n \"release_hour\": 11,\n \"js_head\": \"<string>\",\n \"js_body_top\": \"<string>\",\n \"js_body\": \"<string>\",\n \"css\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.utage-system.com/v1/members/{site_id}/courses/{course_id}/lessons/{lesson_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"lesson_group_id\": \"<string>\",\n \"type\": \"html\",\n \"elements\": [\n {\n \"type\": \"<string>\",\n \"element_id\": 123,\n \"children\": [\n {}\n ]\n }\n ],\n \"is_published\": true,\n \"show_title\": true,\n \"width\": 123,\n \"background_color\": \"<string>\",\n \"use_comment\": true,\n \"is_comment_override\": true,\n \"comment_text\": \"<string>\",\n \"comment_show_type\": \"<string>\",\n \"hide_comment_posted_at\": true,\n \"comment_default_value\": \"<string>\",\n \"has_target_persons\": true,\n \"target_persons_date_from\": \"2023-12-25\",\n \"target_persons_date_to\": \"2023-12-25\",\n \"release_type\": \"<string>\",\n \"release_day\": 4999,\n \"release_month\": 4999,\n \"release_date\": \"2023-12-25\",\n \"release_hour\": 11,\n \"js_head\": \"<string>\",\n \"js_body_top\": \"<string>\",\n \"js_body\": \"<string>\",\n \"css\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.utage-system.com/v1/members/{site_id}/courses/{course_id}/lessons/{lesson_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"lesson_group_id\": \"<string>\",\n \"type\": \"html\",\n \"elements\": [\n {\n \"type\": \"<string>\",\n \"element_id\": 123,\n \"children\": [\n {}\n ]\n }\n ],\n \"is_published\": true,\n \"show_title\": true,\n \"width\": 123,\n \"background_color\": \"<string>\",\n \"use_comment\": true,\n \"is_comment_override\": true,\n \"comment_text\": \"<string>\",\n \"comment_show_type\": \"<string>\",\n \"hide_comment_posted_at\": true,\n \"comment_default_value\": \"<string>\",\n \"has_target_persons\": true,\n \"target_persons_date_from\": \"2023-12-25\",\n \"target_persons_date_to\": \"2023-12-25\",\n \"release_type\": \"<string>\",\n \"release_day\": 4999,\n \"release_month\": 4999,\n \"release_date\": \"2023-12-25\",\n \"release_hour\": 11,\n \"js_head\": \"<string>\",\n \"js_body_top\": \"<string>\",\n \"js_body\": \"<string>\",\n \"css\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"lesson_group_id": "<string>",
"type": "html",
"lesson_url": "<string>",
"is_published": true,
"show_title": true,
"width": 123,
"background_color": "<string>",
"use_comment": true,
"is_comment_override": true,
"comment_text": "<string>",
"comment_show_type": "<string>",
"hide_comment_posted_at": true,
"comment_default_value": "<string>",
"js_head": "<string>",
"js_body_top": "<string>",
"js_body": "<string>",
"css": "<string>",
"release_type": "<string>",
"release_day": 123,
"release_month": 123,
"release_date": "<string>",
"release_hour": 123,
"action_before_release": "show",
"has_target_persons": true,
"target_persons_date_from": "<string>",
"target_persons_date_to": "<string>",
"elements": [
{
"type": "<string>",
"element_id": 123,
"children": [
{}
]
}
],
"order": 123,
"created_at": "<string>",
"updated_at": "<string>"
}
}レッスン
レッスン更新
レッスンを更新します。指定したフィールドのみを更新する部分更新です。リクエストに含めなかったフィールドは既存の値が維持されます。
選択肢のある項目(release_type / comment_show_type / width / background_color)と release_type ごとの条件付き必須は、値を変更する場合にだけ検証します(取得した値をそのまま送り返せます)。
lesson_group_id を変更すると、新しいレッスングループの末尾に移動します(位置を指定して移動するときは並び替えを使ってください)。
elements は element_id で既存の要素と同期します。
element_idあり: 既存要素の部分更新(送ったプロパティだけ変更。typeは省略可、変更は不可)element_idなし: 新規要素として追加- リクエストに含めなかった既存要素: 削除
- 既存要素で
childrenを省略: 子要素をそのまま維持(空配列は不可) elements自体を省略: 要素を変更しない
参照系プロパティ(button の target_element_id、video-chapter の related_element_id、countdown / video の show_element_ids / hide_element_ids)はここで設定します。キーを送ったときだけ更新し、null または空配列を送ると解除します。参照先が存在しない・削除対象の要素は 422 です。
memo 要素を含むレッスンでは、memo 要素の順序を変えないでください(受講生が入力したメモは要素の順序で紐づくため、別の memo に移ることがあります)。
次の場合は 400 になります。
- 「リッチテキスト」(
type=rich_text)のレッスン(bad_request。一覧の取得と並び替えは可能) typeに既存と異なる値を指定した(bad_request。種類は変更できません)release_type=reader_dateへ変更したが、会員サイトの「ログインなしでの閲覧」が「不可」(bad_request)- レッスンで使えない要素タイプを含む(
bad_request) - 同じ
element_idを複数の要素に指定した(duplicate_element_id) - 存在しない
element_idを指定した(invalid_element_id)
レッスン更新
curl --request PATCH \
--url https://api.utage-system.com/v1/members/{site_id}/courses/{course_id}/lessons/{lesson_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"lesson_group_id": "<string>",
"type": "html",
"elements": [
{
"type": "<string>",
"element_id": 123,
"children": [
{}
]
}
],
"is_published": true,
"show_title": true,
"width": 123,
"background_color": "<string>",
"use_comment": true,
"is_comment_override": true,
"comment_text": "<string>",
"comment_show_type": "<string>",
"hide_comment_posted_at": true,
"comment_default_value": "<string>",
"has_target_persons": true,
"target_persons_date_from": "2023-12-25",
"target_persons_date_to": "2023-12-25",
"release_type": "<string>",
"release_day": 4999,
"release_month": 4999,
"release_date": "2023-12-25",
"release_hour": 11,
"js_head": "<string>",
"js_body_top": "<string>",
"js_body": "<string>",
"css": "<string>"
}
'import requests
url = "https://api.utage-system.com/v1/members/{site_id}/courses/{course_id}/lessons/{lesson_id}"
payload = {
"name": "<string>",
"lesson_group_id": "<string>",
"type": "html",
"elements": [
{
"type": "<string>",
"element_id": 123,
"children": [{}]
}
],
"is_published": True,
"show_title": True,
"width": 123,
"background_color": "<string>",
"use_comment": True,
"is_comment_override": True,
"comment_text": "<string>",
"comment_show_type": "<string>",
"hide_comment_posted_at": True,
"comment_default_value": "<string>",
"has_target_persons": True,
"target_persons_date_from": "2023-12-25",
"target_persons_date_to": "2023-12-25",
"release_type": "<string>",
"release_day": 4999,
"release_month": 4999,
"release_date": "2023-12-25",
"release_hour": 11,
"js_head": "<string>",
"js_body_top": "<string>",
"js_body": "<string>",
"css": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
lesson_group_id: '<string>',
type: 'html',
elements: [{type: '<string>', element_id: 123, children: [{}]}],
is_published: true,
show_title: true,
width: 123,
background_color: '<string>',
use_comment: true,
is_comment_override: true,
comment_text: '<string>',
comment_show_type: '<string>',
hide_comment_posted_at: true,
comment_default_value: '<string>',
has_target_persons: true,
target_persons_date_from: '2023-12-25',
target_persons_date_to: '2023-12-25',
release_type: '<string>',
release_day: 4999,
release_month: 4999,
release_date: '2023-12-25',
release_hour: 11,
js_head: '<string>',
js_body_top: '<string>',
js_body: '<string>',
css: '<string>'
})
};
fetch('https://api.utage-system.com/v1/members/{site_id}/courses/{course_id}/lessons/{lesson_id}', 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.utage-system.com/v1/members/{site_id}/courses/{course_id}/lessons/{lesson_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'lesson_group_id' => '<string>',
'type' => 'html',
'elements' => [
[
'type' => '<string>',
'element_id' => 123,
'children' => [
[
]
]
]
],
'is_published' => true,
'show_title' => true,
'width' => 123,
'background_color' => '<string>',
'use_comment' => true,
'is_comment_override' => true,
'comment_text' => '<string>',
'comment_show_type' => '<string>',
'hide_comment_posted_at' => true,
'comment_default_value' => '<string>',
'has_target_persons' => true,
'target_persons_date_from' => '2023-12-25',
'target_persons_date_to' => '2023-12-25',
'release_type' => '<string>',
'release_day' => 4999,
'release_month' => 4999,
'release_date' => '2023-12-25',
'release_hour' => 11,
'js_head' => '<string>',
'js_body_top' => '<string>',
'js_body' => '<string>',
'css' => '<string>'
]),
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.utage-system.com/v1/members/{site_id}/courses/{course_id}/lessons/{lesson_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"lesson_group_id\": \"<string>\",\n \"type\": \"html\",\n \"elements\": [\n {\n \"type\": \"<string>\",\n \"element_id\": 123,\n \"children\": [\n {}\n ]\n }\n ],\n \"is_published\": true,\n \"show_title\": true,\n \"width\": 123,\n \"background_color\": \"<string>\",\n \"use_comment\": true,\n \"is_comment_override\": true,\n \"comment_text\": \"<string>\",\n \"comment_show_type\": \"<string>\",\n \"hide_comment_posted_at\": true,\n \"comment_default_value\": \"<string>\",\n \"has_target_persons\": true,\n \"target_persons_date_from\": \"2023-12-25\",\n \"target_persons_date_to\": \"2023-12-25\",\n \"release_type\": \"<string>\",\n \"release_day\": 4999,\n \"release_month\": 4999,\n \"release_date\": \"2023-12-25\",\n \"release_hour\": 11,\n \"js_head\": \"<string>\",\n \"js_body_top\": \"<string>\",\n \"js_body\": \"<string>\",\n \"css\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.utage-system.com/v1/members/{site_id}/courses/{course_id}/lessons/{lesson_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"lesson_group_id\": \"<string>\",\n \"type\": \"html\",\n \"elements\": [\n {\n \"type\": \"<string>\",\n \"element_id\": 123,\n \"children\": [\n {}\n ]\n }\n ],\n \"is_published\": true,\n \"show_title\": true,\n \"width\": 123,\n \"background_color\": \"<string>\",\n \"use_comment\": true,\n \"is_comment_override\": true,\n \"comment_text\": \"<string>\",\n \"comment_show_type\": \"<string>\",\n \"hide_comment_posted_at\": true,\n \"comment_default_value\": \"<string>\",\n \"has_target_persons\": true,\n \"target_persons_date_from\": \"2023-12-25\",\n \"target_persons_date_to\": \"2023-12-25\",\n \"release_type\": \"<string>\",\n \"release_day\": 4999,\n \"release_month\": 4999,\n \"release_date\": \"2023-12-25\",\n \"release_hour\": 11,\n \"js_head\": \"<string>\",\n \"js_body_top\": \"<string>\",\n \"js_body\": \"<string>\",\n \"css\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.utage-system.com/v1/members/{site_id}/courses/{course_id}/lessons/{lesson_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"lesson_group_id\": \"<string>\",\n \"type\": \"html\",\n \"elements\": [\n {\n \"type\": \"<string>\",\n \"element_id\": 123,\n \"children\": [\n {}\n ]\n }\n ],\n \"is_published\": true,\n \"show_title\": true,\n \"width\": 123,\n \"background_color\": \"<string>\",\n \"use_comment\": true,\n \"is_comment_override\": true,\n \"comment_text\": \"<string>\",\n \"comment_show_type\": \"<string>\",\n \"hide_comment_posted_at\": true,\n \"comment_default_value\": \"<string>\",\n \"has_target_persons\": true,\n \"target_persons_date_from\": \"2023-12-25\",\n \"target_persons_date_to\": \"2023-12-25\",\n \"release_type\": \"<string>\",\n \"release_day\": 4999,\n \"release_month\": 4999,\n \"release_date\": \"2023-12-25\",\n \"release_hour\": 11,\n \"js_head\": \"<string>\",\n \"js_body_top\": \"<string>\",\n \"js_body\": \"<string>\",\n \"css\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"lesson_group_id": "<string>",
"type": "html",
"lesson_url": "<string>",
"is_published": true,
"show_title": true,
"width": 123,
"background_color": "<string>",
"use_comment": true,
"is_comment_override": true,
"comment_text": "<string>",
"comment_show_type": "<string>",
"hide_comment_posted_at": true,
"comment_default_value": "<string>",
"js_head": "<string>",
"js_body_top": "<string>",
"js_body": "<string>",
"css": "<string>",
"release_type": "<string>",
"release_day": 123,
"release_month": 123,
"release_date": "<string>",
"release_hour": 123,
"action_before_release": "show",
"has_target_persons": true,
"target_persons_date_from": "<string>",
"target_persons_date_to": "<string>",
"elements": [
{
"type": "<string>",
"element_id": 123,
"children": [
{}
]
}
],
"order": 123,
"created_at": "<string>",
"updated_at": "<string>"
}
}PATCH
https://api.utage-system.com/v1/members/{site_id}/courses/{course_id}/lessons/{lesson_id}
Path Parameters
Body
application/json
指定したフィールドのみ更新する部分更新。null を指定できる項目は null で値をクリアします