ファイルに適用されたメタデータテンプレートのインスタンスを取得します。
12345
ファイルを表す一意の識別子。
ファイルIDを確認するには、ウェブアプリケーションでファイルにアクセスして、URLからIDをコピーします。たとえば、URLがhttps://*.app.box.com/files/123
の場合、file_id
は123
です。
global
メタデータテンプレートのスコープ
次の値のいずれか1つ: global
,enterprise
properties
メタデータテンプレートの名前
ユーザーまたはアプリケーションによって定義された追加の"キー/値"ペアを含むメタデータテンプレートのインスタンス。
リクエストパラメータが無効な場合に返されます。
指定したメタデータテンプレートがこのファイルに適用されていない場合、またはユーザーがこのファイルにアクセスできない場合に返されます。
instance_not_found
- メタデータテンプレートがファイルに適用されていなかった場合に返されます。メソッドが許可されなかった場合に返されます。
予期しないクライアントエラー。
curl -X GET https://api.box.com/2.0/files/12345/metadata/enterprise_27335/blueprintTemplate \
-H 'Authorization: Bearer <ACCESS_TOKEN>'
Dictionary<string, object> metadata = await client.MetadataManager.
.GetFileMetadataAsync(fileId: "11111", "enterprise", "marketingCollateral");
// Get the default free-form metadata properties
BoxFile file = new BoxFile(api, "id");
Metadata metadata = file.getMetadata();
// Unknown type metadata field, you can test for type or try to get as any type
JsonValue unknownValue = metadata.getValue("/someField");
// String or Enum metadata fields
String stringValue = metadata.getString("/author");
// Float metadata fields can be interpreted as any numeric type
float floatValue = metadata.getFloat("/price");
// Date metadata fields
Date dateValue = metadata.getDate("/deadline");
// Multiselect metadata fields
List<String> multiSelectValues = metadata.getMultiSelect("/categories");
metadata = client.file(file_id='11111').metadata(scope='enterprise', template='myMetadata').get()
print('Got metadata instance {0}'.format(metadata['$id']))
client.files.getMetadata('11111', client.metadata.scopes.ENTERPRISE, 'marketingCollateral')
.then(metadata => {
/* metadata -> {
audience: 'internal',
documentType: 'Q1 plans',
competitiveDocument: 'no',
status: 'active',
author: 'Jones',
currentState: 'proposal',
'$type': 'marketingCollateral-d086c908-2498-4d3e-8a1f-01e82bfc2abe',
'$parent': 'file_11111',
'$id': '2094c584-68e1-475c-a581-534a4609594e',
'$version': 0,
'$typeVersion': 0,
'$template': 'marketingCollateral',
'$scope': 'enterprise_12345' }
*/
});
client.metadata.get(
forFileWithId: "11111",
scope: "enterprise",
templateKey: "personnelRecord"
) { (result: Result<MetadataObject, BoxSDKError>) in
guard case let .success(metadata) = result {
print("Error retrieving metadata")
return
}
print("Found personnel record for \(metadata.keys["name"])")
}