Content Type
最終更新: 2026年7月3日
CDA(Content Delivery API)は、公開済みリソースを公開訪問者に配信する読み取り専用の API です。このページでは、公開済みの Content Type、つまり Content が従う型(スキーマ)を取得する方法を扱います。この型がどのようなフィールドを持ち、各フィールドがどのような型・多言語対応の有無・必須の有無・バリデーションルールを持つかを CDA で読み取れば、その型に従う公開済み Content の形をあらかじめ把握できます。
CDA には取得(GET)エンドポイントのみがあり、Content Type を作成・修正・公開する操作は CMA Content Type が担います。認証や公開配信モデル(公開スナップショット・revision・公開されたものだけが見える)など CDA 共通の動作は CDA 概要 を参照してください。Content Type は型のスキーマであるため、取得時に locale パラメータを受け取りません。
リソース構造
以下は、デモ Space の公開済み Content Type "商品" を CDA が単一取得で配信する形です。sys(システム属性)とともに、name、displayField、publishWithAuthor、fields といった本文属性を持ちます。
{
"sys": {
"id": "3trmXRLdJF4GBlAjtcuoZ7Pnxj8dlA",
"type": "ContentType",
"space": { "sys": { "id": "HnQ32YiH", "type": "Refer", "targetType": "Space" } },
"createdAt": "2026-06-14T17:04:46.846Z",
"updatedAt": "2026-06-17T03:13:49.943Z",
"revision": 7
},
"name": "商品",
"displayField": "productName",
"fields": [
{ "id": "5n06s7ocmwdi", "name": "商品名", "apiName": "productName", "type": "ShortText", "localized": true, "required": true, "validations": [], "disabled": false },
{ "id": "1gecyz8g4llwf", "name": "価格", "apiName": "price", "type": "Long", "localized": false, "required": false, "validations": [], "disabled": false },
{ "id": "3ow4popgz54zg", "name": "詳細説明", "apiName": "description", "type": "RichText", "localized": true, "required": false, "validations": [], "disabled": false },
{ "id": "2alxdptmdub1s", "name": "代表写真", "apiName": "photo", "type": "Refer", "localized": false, "required": false, "validations": [], "disabled": false, "targetType": "Media" },
{
"id": "2a80lehazfx3t",
"name": "ブランド",
"apiName": "brand",
"type": "Refer",
"localized": false,
"required": false,
"validations": [
{ "referContentType": [ { "sys": { "id": "3trmXRM3RqbgSnifyg7OveRYWnJWEG", "type": "Refer", "targetType": "ContentType" } } ] }
],
"disabled": false,
"targetType": "Content"
}
],
"publishWithAuthor": false
}主要なキー:
sys.id: Content Type の一意な識別子です。単一取得パスの{contentTypeId}に入ります。sys.revision: 公開された時点のバージョンです。CDA は管理用のversionを含まないため、公開バージョンを指す値はrevision一つです。name: Content Type の名前です(例:商品)。displayField: コンテンツスタジオの一覧で各 Content を代表して表示するフィールドのapiNameです(例:productName)。publishWithAuthor: Content の公開時に作成者情報を一緒に含めるかどうかです(例ではfalse)。fields: この型が定義するフィールドの一覧です。各項目の構造は下記 フィールド で説明します。
システム属性 (sys)
公開済み Content Type の sys は、公開スナップショット用の属性のみを含みます。space、createdBy、updatedBy は Refer の形({ "sys": { "id", "type": "Refer", "targetType" } })で入ります。
| 属性 | 型 | 説明 |
|---|---|---|
id | string | リソースの一意な識別子。 |
type | string | リソースの種類。Content Type は常に "ContentType"。 |
space | Refer<Space> | この Content Type が属する Space。 |
createdAt | string (date-time) | 作成日時。 |
updatedAt | string (date-time) | 最終更新日時。 |
revision | integer | 公開された時点のバージョン。公開するたびに、その時点のバージョンがここに入ります。 |
createdBy | Refer<User> | 作成したユーザー。Content Type の publishWithAuthor が有効なときのみ含まれます。 |
updatedBy | Refer<User> | 最後に修正したユーザー。publishWithAuthor が有効なときのみ含まれます。 |
公開スナップショットであるため、CMA の sys にある version・status・publish・archive は含まれません。公開バージョンを指す値は revision 一つだけです。
フィールド
fields は、この Content Type が定義するフィールドの一覧です。各項目は次の構造(FieldDefinition)を持ちます。
| キー | 型 | 説明 |
|---|---|---|
id | string | フィールドの一意な識別子。 |
name | string | コンテンツスタジオに表示されるフィールド名(例: 商品名)。 |
apiName | string | API でこのフィールドを指すキー。公開済み Content の fields でも、このキーで値を読み取ります。 |
type | string (enum) | フィールドの型。下記 フィールドの種類 (type) を参照。 |
localized | boolean | 多言語の値を持てるかどうか。 |
required | boolean | 必須入力かどうか。 |
validations | array | 値に適用されたバリデーションルールの一覧。ルールがなければ空の配列 []。 |
disabled | boolean | 無効化されているかどうか。 |
targetType | string (enum) | type が Refer のときのみ。参照先が Content か Media か。 |
items | object | type が Array のときのみ。配列要素の定義(Refer 要素または ShortText 要素)。 |
フィールドの種類 (type)
type は、値が保存・取得される方式を決定します。一部の型は検索動作が異なります。
type | 意味 | 備考 |
|---|---|---|
ShortText | 短い単一行テキスト。 | 正確なキーワード取得に適する。 |
LongText | 長い本文テキスト。 | 全文(full-text)類似度検索をサポート。 |
RichText | 書式のある本文。 | 検索対象ではなく、書式表現用。 |
Long | 整数。 | 例: 価格 price。 |
Number | 実数(小数を含む)。 | |
Boolean | 真/偽。 | |
Date | 日付・時刻。 | |
Json | 任意の JSON 構造。 | |
Location | 位置(座標)。 | |
Refer | 他のリソースを指す参照。 | targetType で Content または Media を指定。 |
Array | 複数の値を保持する配列。 | items で要素定義を伴う。 |
"商品" の例では、商品名 は ShortText、価格 は Long、詳細説明 は RichText、代表写真 は Refer(targetType: Media)、ブランド は Refer(targetType: Content)です。ブランド フィールドは validations の referContentType で、特定の Content Type(ここでは "ブランド"、sys.id が 3trmXRM3RqbgSnifyg7OveRYWnJWEG)の Content のみを参照するよう制限します。
validations に使えるバリデーションルールの全キーカタログは CMA Content Type にまとめられています。CDA が配信する公開スナップショットも、同じ構造をそのまま含みます。
API
以下の二つのエンドポイントの基準 URL は https://cda.weegloo.com/v1 であり、Authorization ヘッダーに CDA を認証する Bearer トークンが必要です。Content Type は型(スキーマ)であり、言語を選ぶ対象ではないため、Content の取得とは異なり locale クエリパラメータを受け取りません。
関連ドキュメント
- CMA Content Type: Content Type を作成・修正する管理 API(フィールド型・バリデーションの全仕様を含む)。
- CDA Content: この型に従う公開済み Content を配信で受け取る。
- 状態と公開 (コンセプト): 公開・バージョンの意味。
