メインコンテンツへスキップ
POST
/
metadata_templates
/
schema
cURL
curl -i -X POST "https://api.box.com/2.0/metadata_templates/schema" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -H "content-type: application/json" \
     -d '{
      "scope": "enterprise",
      "displayName": "Customer",
      "fields": [
        {
          "type": "string",
          "key": "name",
          "displayName": "Name",
          "description": "The customer name",
          "hidden": false
        },
        {
          "type": "date",
          "key": "last_contacted_at",
          "displayName": "Last Contacted At",
          "description": "When this customer was last contacted at",
          "hidden": false
        },
        {
          "type": "enum",
          "key": "industry",
          "displayName": "Industry",
          "options": [
            {"key": "Technology"},
            {"key": "Healthcare"},
            {"key": "Legal"}
          ]
        },
        {
          "type": "multiSelect",
          "key": "role",
          "displayName": "Contact Role",
          "options": [
            {"key": "Developer"},
            {"key": "Business Owner"},
            {"key": "Marketing"},
            {"key": "Legal"},
            {"key": "Sales"}
          ]
        }
      ]
    }'
{
  "id": "58063d82-4128-7b43-bba9-92f706befcdf",
  "type": "metadata_template",
  "scope": "enterprise_123456",
  "templateKey": "productInfo",
  "displayName": "Product Info",
  "hidden": true,
  "fields": [
    {
      "type": "string",
      "key": "category",
      "displayName": "Category",
      "description": "The category",
      "hidden": true,
      "options": [
        {
          "key": "Category 1",
          "id": "45dc2849-a4a7-40a9-a751-4a699a589190"
        }
      ],
      "id": "822227e0-47a5-921b-88a8-494760b2e6d2"
    }
  ],
  "copyInstanceOnItemCopy": true
}
このリソースは、バージョン2024.0のエンドポイントで使用されています。 詳細については、 Box APIのバージョン管理を参照してください。Box SDKのバージョニング戦略について詳しく学ぶ。」

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Body

application/json
scope
string
required

作成するメタデータテンプレートのスコープ。アプリケーションで作成できるのは、認証済みユーザーの会社内で使用するテンプレートのみです。

この値はenterpriseに設定する必要があります。globalスコープはアプリケーションで作成できないからです。

Example:

"enterprise"

displayName
string
required

テンプレートの表示名。

Maximum string length: 4096
Example:

"Product Info"

templateKey
string

テンプレートの一意の識別子。この識別子は、メタデータテンプレート作成の対象となる会社全体で一意である必要があります。

指定しなかった場合、APIによりdisplayNameの値に基づいて一意のtemplateKeyが作成されます。

Maximum string length: 64
Example:

"productInfo"

hidden
boolean
default:false

このテンプレートをBoxウェブアプリのUIに表示するか、APIを介した使用のみを目的とするかを定義します。

Example:

true

fields
メタデータフィールド (書き込み) · object[]

テンプレートに含まれるテンプレートフィールドの順序付きリスト。各フィールドは、通常のテキストフィールド、日付フィールド、数値フィールド、単一または複数選択リストのいずれかになります。

copyInstanceOnItemCopy
boolean
default:false

ファイルまたはフォルダをコピーするときに、追加されているメタデータをコピーするかどうか。デフォルトでは、ファイルまたはフォルダのコピー時に、メタデータは一緒にコピーされません。

Example:

true

Response

作成されたメタデータテンプレートを表すスキーマ。

ファイルやフォルダに適用可能なメタデータのテンプレート。

id
string
required

メタデータテンプレートのID。

Example:

"58063d82-4128-7b43-bba9-92f706befcdf"

type
enum<string>
required

値は常にmetadata_templateになります。

利用可能なオプション:
metadata_template
Example:

"metadata_template"

scope
string

メタデータテンプレートのスコープは、globalまたはenterprise_*のいずれかになります。globalスコープは、Boxを使用するすべての会社が利用できるテンプレートに使用されます。enterprise_*スコープは、特定の会社内で作成されたテンプレートを表します (*はその会社のID)。

Example:

"enterprise_123456"

templateKey
string

テンプレートの一意の識別子。この識別子は、メタデータテンプレートが適用される会社のscope全体で一意ですが、会社を越えて一意であるとは限りません。

Maximum string length: 64
Example:

"productInfo"

displayName
string

テンプレートの表示名。Boxウェブアプリとモバイルアプリに表示されます。

Maximum string length: 4096
Example:

"Product Info"

hidden
boolean

このテンプレートをBoxウェブアプリのUIに表示するか、APIを介した使用のみを目的とするかを定義します。

Example:

true

fields
メタデータフィールド (読み取り) · object[]

テンプレートに含まれるテンプレートフィールドの順序付きリスト。各フィールドは、通常のテキストフィールド、日付フィールド、数値フィールド、単一または複数選択リストのいずれかになります。

copyInstanceOnItemCopy
boolean

ファイルまたはフォルダのコピー時にメタデータを含めるかどうか。

Example:

true