Contents

Create a content

Craft Cross CMSのコンテンツを作成します。

Required Scope

APIの実行に必要なScopeです。

beta.cms.content.create

Required Role

管理画面でScopeを追加する際に必要な権限です。

Craft Cross CMS > CMSの編集
post/v2beta/cms/content/create

Request

  • Base URL
    https://api.karte.io
  • URL
    https://api.karte.io/v2beta/cms/content/create
  • Auth
    HTTP bearer

Headers

x-karte-apistring

今後利用する可能性のある予約語です。現在は設定不要です。

authorizationstring

認証情報を含むトークンです。"Authorization" ヘッダーに Bearer <token> の形式で設定してください。

content-typestring

リクエストのコンテンツタイプを指定します。通常は application/json を使用してください。

Request body

modelIdstring required

コンテンツが所属するモデルのID

dataobject required

コンテンツの内容を指定します。モデルで定義したフィールドに従って、コンテンツの内容を指定してください。

リッチテキストフィールドの指定方法

リッチテキストフィールドの値は json 要素のみ有効です。 text および html は無視されます。

例: ID richtext のリッチテキストフィールドに、 <h1>RichText</h1> という内容を指定する場合、次のように指定します。

"richtext": {
  "json": {
    "type": "doc",
    "content": [
      {
        "type": "heading",
        "attrs": {
          "level": 1
        },
        "content": [
          {
            "type": "text",
            "text": "RichText"
          }
        ]
      }
    ]
  }
}

画像フィールドの指定方法

画像フィールドの値は、メディアライブラリの画像のIDを文字列として指定してください。

例:image というIDの画像フィールドに、6347f05d5d18d4536af5f336 というIDの画像を指定する場合、次のように指定します。

"image": "6347f05d5d18d4536af5f336"
kickHookV2boolean

この操作でHook V2のトリガーを発火するかどうか。(参照)

Example request

{
  "modelId": "6347f05d5d18d4536af5f336",
  "kickHookV2": true
}

Response

A successful response.

idstring required

コンテンツのIDです。

Example response

{
  "id": "6109f05d5d18d6006af5f385",
  "title": "title1",
  "body": {
    "text": "Rich Text",
    "html": "<h1>Rich Text</h1>",
    "json": {
      "type": "doc",
      "content": [
        {
          "type": "heading",
          "attrs": {
            "level": 1
          },
          "content": [
            {
              "type": "text",
              "text": "RichText"
            }
          ]
        }
      ]
    }
  },
  "sys": {
    "customOrder": 15,
    "modelId": "6347f05d5d18d4536af5f336",
    "raw": {
      "createdAt": "2025-04-06T00:18:26.810Z",
      "createdBy": "6757a6444bf949f948348941",
      "updatedAt": "2025-04-06T08:39:45.628Z",
      "updatedBy": "6757a6444bf949f948348941",
      "firstPublishedAt": "2025-04-06T00:18:26.810Z",
      "publishedAt": "2025-04-06T08:39:45.628Z",
      "contentId": "6109f05d5d18d6006af5f385",
      "revisionId": "67ce733b3640300ad776d80e",
      "publishedRevisionId": "67ce733b3640300ad776d80e"
    }
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.