Box Developerドキュメント

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

ファイル情報の取得

ガイド ファイル ファイル情報の取得

ファイル情報の取得

ファイルのコンテンツではなく、ファイル自体の情報を取得するには、ファイルのidを指定してGET /files/:id APIを呼び出します。

cURL
curl -i -X GET "https://api.box.com/2.0/files/12345" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
Node/TypeScript v10
await client.files.getFileById(uploadedFile.id, {
  queryParams: {
    fields: ['is_externally_owned', 'has_collaborations'],
  } satisfies GetFileByIdQueryParams,
} satisfies GetFileByIdOptionalsInput);
Python v10
client.files.get_file_by_id(
    uploaded_file.id, fields=["is_externally_owned", "has_collaborations"]
)
.NET v10
await client.Files.GetFileByIdAsync(fileId: uploadedFile.Id, queryParams: new GetFileByIdQueryParams() { Fields = Array.AsReadOnly(new [] {"is_externally_owned","has_collaborations"}) });
Swift v10
try await client.files.getFileById(fileId: uploadedFile.id, queryParams: GetFileByIdQueryParams(fields: ["is_externally_owned", "has_collaborations"]))
Java v10
client.getFiles().getFileById(uploadedFile.getId(), new GetFileByIdQueryParams.Builder().fields(Arrays.asList("is_externally_owned", "has_collaborations")).build())
.NET v6
await client.Files.GetFileByIdAsync(fileId: uploadedFile.Id, queryParams: new GetFileByIdQueryParams() { Fields = Array.AsReadOnly(new [] {"is_externally_owned","has_collaborations"}) });
Node v4
await client.files.getFileById(uploadedFile.id, {
  queryParams: {
    fields: ['is_externally_owned', 'has_collaborations'],
  } satisfies GetFileByIdQueryParams,
} satisfies GetFileByIdOptionalsInput);

ファイルID

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

その他のフィールド

ファイルのフィールドをさらに取得するには、必ずfieldsクエリパラメータを渡してください。

追加フィールドのリクエストについて確認する