コンテンツを作成する(POST /contents)
基本情報
ベータ版機能について
この機能はベータ版での提供となっており、動作が不安定な場合があります。
また、今後互換性を保たない変更が加わる可能性があります。
あらかじめご了承いただいた上でのご利用をお願いいたします。
コンテンツを1件新規作成します。
POST/v1/contents
https://cms-api.nilto.com/v1/contents
リクエスト
リクエストパラメータ
X-NILTO-API-KEYX-NILTO-API-KEY | NILTO APIキー。 スペース設定のAPIキー画面で取得することができます。 |
model必須 | string |
published | boolean |
space | string |
ft_format | string |
fields | object (contentRequest) |
fields[{lang_key}] | any |
リクエスト例
curl -X POST "https://cms-api.nilto.com/v1/contents?model=news&published=false" \
-H "X-NILTO-API-KEY: 0000000000000000000000" \
-H "Content-Type: application/json" \
-d '{
"fields": {
"flexibletext_field": "<h2>タイトル</h2><p>本文のテキストです。</p>",
"singleline_field": "1行テキストのサンプル",
"boolean_field": true,
"datetime_field": "2023-03-07T19:00:00Z"
}
}'{
"fields": {
"flexibletext_field": "<h2>abcedf</h2><p>abcedf</p><ul><li>abcedf</li><li>abcedf</li>",
"singleline_field": "foobar",
"multiline_field": "foo\nbar",
"boolean_field": true,
"singleselect_field": "value1",
"datetime_field": "2023-01-23T04:50:00Z",
"media_field": 1234567890,
"repeat_field": [],
"reference_field": 1234567890,
"field_set1": {
"singleline_field": "foobar",
"boolean_field": true
},
"field_set2": {
"multiline_field": "foo\nbar",
"datetime_field": "2023-01-23T04:50:00Z"
},
"combination_field": [
{
"luid": "field_set_a",
"fields": {
"multiline_field": "foo\nbar",
"boolean_field": true
}
},
{
"luid": "field_set_b",
"fields": {
"datetime_field": "2023-01-23T04:50:00Z",
"repeat_field": []
}
},
{
"luid": "field_set_a",
"fields": {
"multiline_field": "foo\nbar\nbaz",
"boolean_field": false
}
}
]
},
"fields[en]": {
"singleline_field": "foobar"
},
"fields[zh-CN]": {
"singleline_field": "foobar"
}
}レスポンス
200 OK
id | integer コンテンツID |
400 Bad Request
status | string |
code | string |
401 Unauthorized
status | string |
code | string |
402 Payment Required
status | string |
code | string |
403 Forbidden
status | string |
code | string |
404 Not Found
status | string |
code | string |
429 Too Many Requests
status | string |
code | string |
message | string |
500 Internal Server Error
status | string |
code | string |
レスポンス例
{
"id": 1234567890
}{
"status": "400",
"code": "BadRequest"
}{
"status": "401",
"code": "Unauthorized"
}{
"status": "402",
"code": "Payment Required"
}{
"status": "403",
"code": "Forbidden"
}{
"status": "404",
"code": "Not Found"
}{
"status": "429",
"code": "Too Many Requests",
"message": "Expected available in 58 seconds."
}{
"status": "500",
"code": "Internal Server Error"
}