scope
とtemplateKey
の値でメタデータテンプレートを取得します。
テンプレートのscope
とtemplateKey
を調べるには、会社のすべてのテンプレートまたはグローバルテンプレートのリストを取得するか、ファイルまたはフォルダに適用されているすべてのテンプレートのリストを取得します。
global
メタデータテンプレートのスコープ
次の値のいずれか1つ: global
,enterprise
properties
メタデータテンプレートの名前
scope
およびtemplate
の名前と一致するメタデータテンプレートを返します。
リクエストのパラメータのいずれかが無効な場合に返されます。
bad_request
: テンプレートのスコープが認識されていない場合によく返されます。scope
の値として必ずenterprise
またはglobal
を使用してください。指定されたscope
およびtemplate_key
を持つテンプレートが見つからない場合に返されます。
予期しないクライアントエラー。
curl -X GET https://api.box.com/2.0/metadata_templates/enterprise/blueprintTemplate/schema \
-H 'Authorization: Bearer <ACCESS_TOKEN>'
BoxMetadataTemplate template = await client.MetadataManager
.GetMetadataTemplate("enterprise", "marketingCollateral");
MetadataTemplate template = MetadataTemplate.getMetadataTemplate(api, "templateName");
template = client.metadata_template('enterprise', 'employeeRecord').get()
print('The {0} template has {1} fields'.format(template.displayName, len(template.fields)))
client.metadata.getTemplateSchema('enterprise', 'vcontract')
.then(template => {
/* template -> {
id: '17f2d715-6acb-45f2-b96a-28b15efc9faa',
templateKey: 'vcontract',
scope: 'enterprise_12345',
displayName: 'Vendor Contract',
hidden: true,
fields:
[ { type: 'date',
key: 'signed',
displayName: 'Date Signed',
hidden: false },
{ type: 'string',
key: 'vendor',
displayName: 'Vendor',
hidden: false },
{ type: 'enum',
key: 'fy',
displayName: 'Fiscal Year',
options:
[ { key: 'FY17' },
{ key: 'FY18' },
{ key: 'FY19' } ],
hidden: false } ] }
*/
});
client.metadata.getTemplateByKey(
scope: "enterprise",
templateKey: "personnelRecord"
) { (result: Result<MetadataTemplate, BoxSDKError>) in
guard case let .success(template) = result {
print("Error retrieving metadata template")
return
}
print("Metadata template has \(template.fields?.count) fields")
}