登録フォーム項目一括作成
curl --request POST \
--url https://api.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/form-items/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"reader_item_id": "<string>",
"name": "<string>",
"is_required": false,
"default_value": "<string>"
}
]
}
'import requests
url = "https://api.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/form-items/bulk"
payload = { "items": [
{
"reader_item_id": "<string>",
"name": "<string>",
"is_required": False,
"default_value": "<string>"
}
] }
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({
items: [
{
reader_item_id: '<string>',
name: '<string>',
is_required: false,
default_value: '<string>'
}
]
})
};
fetch('https://api.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/form-items/bulk', 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/accounts/{account_id}/scenarios/{scenario_id}/form-items/bulk",
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([
'items' => [
[
'reader_item_id' => '<string>',
'name' => '<string>',
'is_required' => false,
'default_value' => '<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/accounts/{account_id}/scenarios/{scenario_id}/form-items/bulk"
payload := strings.NewReader("{\n \"items\": [\n {\n \"reader_item_id\": \"<string>\",\n \"name\": \"<string>\",\n \"is_required\": false,\n \"default_value\": \"<string>\"\n }\n ]\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.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/form-items/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"reader_item_id\": \"<string>\",\n \"name\": \"<string>\",\n \"is_required\": false,\n \"default_value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/form-items/bulk")
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 \"items\": [\n {\n \"reader_item_id\": \"<string>\",\n \"name\": \"<string>\",\n \"is_required\": false,\n \"default_value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "<string>",
"reader_item_id": "<string>",
"reserved_word": "<string>",
"name": "<string>",
"input_type": "<string>",
"is_required": true,
"default_value": "<string>",
"order": 123
}
]
}{
"error": {
"code": "bad_request",
"message": "LINEアカウントではフォーム項目の変更操作はできません"
}
}{
"error": {
"code": "unauthorized",
"message": "APIキーが無効です"
}
}{
"error": {
"code": "not_found",
"message": "読者項目が見つかりません",
"details": {
"items.2.reader_item_id": [
"読者項目が見つかりません"
]
}
}
}{
"error": {
"code": "conflict",
"message": "この読者項目は既に登録フォームに追加されています",
"details": {
"items.2.reader_item_id": [
"この読者項目は既に登録フォームに追加されています"
]
}
}
}{
"error": {
"code": "validation_error",
"message": "入力内容に誤りがあります",
"details": {
"name": [
"管理用タイトルは必須です"
]
}
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "レート制限を超過しました"
}
}登録フォーム・読者項目
登録フォーム項目一括作成
複数の項目を1リクエストで登録フォームに組み込みます。items の各要素は次のどちらかです。
- 読者項目を新しく作って組み込む:
name・data_type・field_group(必須)とinput_type・is_required・default_value - 既存の読者項目を組み込む:
reader_item_id(必須)とinput_type・is_required・default_value
reader_item_id と name / data_type / field_group は同時に指定できません。同じ reader_item_id を配列内で重複して指定することもできません(いずれも 422)。
input_type は data_type が file の項目以外で必須です。入力形式・組み込める読者項目・重複の条件は登録フォーム項目作成と同じです。
1件でもエラーがあると何も作成しません。エラー応答の details のキーは items.{位置}.{項目} です(例: items.2.reader_item_id)。
表示順は既存の末尾から配列順に採番します。応答は作成した登録フォーム項目だけを表示順で返します。
LINE の配信アカウントでは作成できません(400 bad_request)。
登録フォーム項目一括作成
curl --request POST \
--url https://api.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/form-items/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"reader_item_id": "<string>",
"name": "<string>",
"is_required": false,
"default_value": "<string>"
}
]
}
'import requests
url = "https://api.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/form-items/bulk"
payload = { "items": [
{
"reader_item_id": "<string>",
"name": "<string>",
"is_required": False,
"default_value": "<string>"
}
] }
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({
items: [
{
reader_item_id: '<string>',
name: '<string>',
is_required: false,
default_value: '<string>'
}
]
})
};
fetch('https://api.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/form-items/bulk', 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/accounts/{account_id}/scenarios/{scenario_id}/form-items/bulk",
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([
'items' => [
[
'reader_item_id' => '<string>',
'name' => '<string>',
'is_required' => false,
'default_value' => '<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/accounts/{account_id}/scenarios/{scenario_id}/form-items/bulk"
payload := strings.NewReader("{\n \"items\": [\n {\n \"reader_item_id\": \"<string>\",\n \"name\": \"<string>\",\n \"is_required\": false,\n \"default_value\": \"<string>\"\n }\n ]\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.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/form-items/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"reader_item_id\": \"<string>\",\n \"name\": \"<string>\",\n \"is_required\": false,\n \"default_value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/form-items/bulk")
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 \"items\": [\n {\n \"reader_item_id\": \"<string>\",\n \"name\": \"<string>\",\n \"is_required\": false,\n \"default_value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "<string>",
"reader_item_id": "<string>",
"reserved_word": "<string>",
"name": "<string>",
"input_type": "<string>",
"is_required": true,
"default_value": "<string>",
"order": 123
}
]
}{
"error": {
"code": "bad_request",
"message": "LINEアカウントではフォーム項目の変更操作はできません"
}
}{
"error": {
"code": "unauthorized",
"message": "APIキーが無効です"
}
}{
"error": {
"code": "not_found",
"message": "読者項目が見つかりません",
"details": {
"items.2.reader_item_id": [
"読者項目が見つかりません"
]
}
}
}{
"error": {
"code": "conflict",
"message": "この読者項目は既に登録フォームに追加されています",
"details": {
"items.2.reader_item_id": [
"この読者項目は既に登録フォームに追加されています"
]
}
}
}{
"error": {
"code": "validation_error",
"message": "入力内容に誤りがあります",
"details": {
"name": [
"管理用タイトルは必須です"
]
}
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "レート制限を超過しました"
}
}POST
https://api.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/form-items/bulk
Body
application/json