Box Developerドキュメント

Box Developerドキュメントの新しいベータ版サイトがまもなくリリースされる予定です。最新の開発者向けガイド、APIリファレンス、AI搭載の検索により、Boxを使用した迅速な開発をサポートします。更新情報については今しばらくお待ちください。

最新バージョン

ファイルのメタデータインスタンスを取得

get
https://api.box.com/2.0
/files/:file_id/metadata/:scope/:template_key

このエンドポイントはバージョン2024.0です。引き続き使用するために 変更は必要ありません。詳細については、 **Box APIのバージョン管理**を参照してください。

ファイルに適用されたメタデータテンプレートのインスタンスを取得します。

リクエスト

bearer [ACCESS_TOKEN]
application/json

パスパラメータ

stringパス内必須
12345

ファイルを表す一意の識別子。

ファイルIDを確認するには、ウェブアプリケーションでファイルにアクセスして、URLからIDをコピーします。たとえば、URLがhttps://*.app.box.com/files/123の場合、file_id123です。

stringパス内必須
global

メタデータテンプレートのスコープ。

次の値のいずれか1つ: global,enterprise

stringパス内必須
properties

メタデータテンプレートの名前。

レスポンス

ユーザーまたはアプリケーションによって定義された追加の「キー/値」ペアを含むメタデータテンプレートのインスタンス。

リクエストパラメータが無効な場合に返されます。

指定したメタデータテンプレートがこのファイルに適用されていない場合、またはユーザーがこのファイルにアクセスできない場合に返されます。

  • instance_not_found - メタデータテンプレートがファイルに適用されていなかった場合に返されます。

メソッドが許可されなかった場合に返されます。

予期しないクライアントエラー。

get
ファイルのメタデータインスタンスを取得
このドキュメント内で一部のAPIを試せるようになりました。
ログイン

リクエストの例

Box SDKのバージョン戦略の詳細については、 **こちら**を確認してください。


cURL
curl -i -X GET "https://api.box.com/2.0/files/12345/metadata/enterprise_27335/blueprintTemplate" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
Node/TypeScript v10
await client.fileMetadata.getFileMetadataById(
  file.id,
  'global' as GetFileMetadataByIdScope,
  'properties',
);
Python v10
client.file_metadata.get_file_metadata_by_id(
    file.id, GetFileMetadataByIdScope.GLOBAL, "properties"
)
.NET v10
await client.FileMetadata.GetFileMetadataByIdAsync(fileId: file.Id, scope: GetFileMetadataByIdScope.Global, templateKey: "properties");
Swift v10
try await client.fileMetadata.getFileMetadataById(fileId: file.id, scope: GetFileMetadataByIdScope.global, templateKey: "properties")
Java v10
client.getFileMetadata().getFileMetadataById(file.getId(), GetFileMetadataByIdScope.GLOBAL, "properties")
.NET v6
await client.FileMetadata.GetFileMetadataByIdAsync(fileId: file.Id, scope: GetFileMetadataByIdScope.Global, templateKey: "properties");
Node v4
await client.fileMetadata.getFileMetadataById(
  file.id,
  'global' as GetFileMetadataByIdScope,
  'properties',
);

レスポンスの例

{
  "$canEdit": true,
  "$id": "01234500-12f1-1234-aa12-b1d234cb567e",
  "$parent": "folder_59449484661,",
  "$scope": "enterprise_27335",
  "$template": "marketingCollateral",
  "$type": "properties-6bcba49f-ca6d-4d2a-a758-57fe6edf44d0",
  "$typeVersion": 2,
  "$version": 1
}