ガイドレプリゼンテーションファイルレプリゼンテーションのダウンロード

ファイルレプリゼンテーションのダウンロード

ファイルレプリゼンテーションのダウンロード

レプリゼンテーションをダウンロードするには、レプリゼンテーションを選択した際に受け取ったurl_templateを使用します。{+asset_path}は、レプリゼンテーションの種類に応じて置き換えます。

ページ割りされたレプリゼンテーション

PDFのようにページ割りされたレプリゼンテーションでは、{+asset_path}を目的のページ番号とファイル拡張子に置き換えます(例: 1.pdf)。

curl https://dl.boxcloud.com/api/2.0/internal_files/123/versions/345/representations/pdf/content/3.pdf \
  -H "authorization: Bearer ACCESS_TOKEN"

ページ割りされていないレプリゼンテーション

ページ割りされていないレプリゼンテーションでは、{+asset_path}を空の文字列に置き換えます。

curl https://dl.boxcloud.com/api/2.0/internal_files/123/versions/345/representations/jpg_32x32/content/ \
  -H "authorization: Bearer ACCESS_TOKEN"

省略可能なクエリパラメータ

レプリゼンテーションを取得する場合、以下の省略可能なヘッダーを使用できます。

パラメータオプションデフォルト
set_content_disposition_typeinline / attachmentnull

Sets the content-disposition header in the API response with the specified value. A disposition type of attachment causes most web browsers to prompt the user to save the response to their device, where the type inline will open the file in the browser.

指定しなかった場合、応答にcontent-dispositionヘッダーは含まれません。

パラメータオプションデフォルト
set_content_disposition_filenameFilename without extensionnull

Allows the application to define the downloaded representation's file name.

定義しなかった場合、ファイル名は、Box内の元のファイル名から派生し、拡張子はレプリゼンテーションのファイルタイプに置き換えられます。