> ## Documentation Index
> Fetch the complete documentation index at: https://developer.box.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ファイル情報の取得

export const Link = ({href, children, className, ...props}) => {
  const localizedHref = localizeLink(href);
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

export const MultiRelatedLinks = ({sections = []}) => {
  if (!sections || sections.length === 0) {
    return null;
  }
  return <div className="space-y-8">
      {sections.map((section, index) => <RelatedLinks key={index} title={section.title} items={section.items} />)}
    </div>;
};

export const RelatedLinks = ({title, items = []}) => {
  const getBadgeClass = badge => {
    if (!badge) return "badge-default";
    const badgeType = badge.toLowerCase().replace(/\s+/g, "-");
    return `badge-${badge === "ガイド" ? "guide" : badgeType}`;
  };
  if (!items || items.length === 0) {
    return null;
  }
  return <div className="my-8">
      {}
      <h3 className="text-sm font-bold uppercase tracking-wider mb-4">{title}</h3>

      {}
      <div className="flex flex-col gap-3">
        {items.map((item, index) => <a key={index} href={item.href} className="py-2 px-3 rounded related_link hover:bg-[#f2f2f2] dark:hover:bg-[#111827] flex items-center gap-3 group no-underline hover:no-underline border-b-0">
            {}
            <span className={`px-2 py-1 rounded-full text-xs font-semibold uppercase tracking-wide flex-shrink-0 ${getBadgeClass(item.badge)}`}>
              {item.badge}
            </span>

            {}
            <span className="text-base">{item.label}</span>
          </a>)}
      </div>
    </div>;
};

ファイルのコンテンツではなく、ファイル自体の情報を取得するには、ファイルの`id`を指定して<Link href="/reference/get-files-id">`GET /files/:id`</Link> APIを呼び出します。

<CodeGroup>
  ```sh cURL theme={null}
  curl -i -X GET "https://api.box.com/2.0/files/12345" \
       -H "authorization: Bearer <ACCESS_TOKEN>"
  ```

  ```typescript Node/TypeScript v10 theme={null}
  await client.files.getFileById(uploadedFile.id, {
    queryParams: {
      fields: ['is_externally_owned', 'has_collaborations'],
    } satisfies GetFileByIdQueryParams,
  } satisfies GetFileByIdOptionalsInput);
  ```

  ```python Python v10 theme={null}
  client.files.get_file_by_id(
      uploaded_file.id, fields=["is_externally_owned", "has_collaborations"]
  )
  ```

  ```cs .NET v10 theme={null}
  await client.Files.GetFileByIdAsync(fileId: uploadedFile.Id, queryParams: new GetFileByIdQueryParams() { Fields = Array.AsReadOnly(new [] {"is_externally_owned","has_collaborations"}) });
  ```

  ```swift Swift v10 theme={null}
  try await client.files.getFileById(fileId: uploadedFile.id, queryParams: GetFileByIdQueryParams(fields: ["is_externally_owned", "has_collaborations"]))
  ```

  ```java Java v10 theme={null}
  client.getFiles().getFileById(uploadedFile.getId(), new GetFileByIdQueryParams.Builder().fields(Arrays.asList("is_externally_owned", "has_collaborations")).build())
  ```

  ```java Java v5 theme={null}
  BoxFile file = new BoxFile(api, "id");
  BoxFile.Info info = file.getInfo();
  ```

  ```python Python v4 theme={null}
  file_id = '11111'
  file_info = client.file(file_id).get()
  print(f'File "{file_info.name}" has a size of {file_info.size} bytes')
  ```

  ```cs .NET v6 theme={null}
  BoxFile file = await client.FilesManager.GetInformationAsync(id: "11111");
  ```

  ```javascript Node v4 theme={null}
  client.files.get('11111')
  	.then(file => {
  		/* file -> {
  			type: 'file',
  			id: '11111',
  			file_version: 
  			{ type: 'file_version',
  				id: '22222',
  				sha1: '97b3dbba6eab7ad0f058240744c8636b7c7bea93' },
  			sequence_id: '1',
  			etag: '1',
  			sha1: '97b3dbba6eab7ad0f058240744c8636b7c7bea93',
  			name: 'Puppy.png',
  			description: '',
  			size: 106833,
  			path_collection: 
  			{ total_count: 2,
  				entries: 
  				[ { type: 'folder',
  					id: '0',
  					sequence_id: null,
  					etag: null,
  					name: 'All Files' },
  					{ type: 'folder',
  					id: '33333',
  					sequence_id: '0',
  					etag: '0',
  					name: 'Collaborated Folder' } ] },
  			created_at: '2016-11-16T22:01:44-08:00',
  			modified_at: '2016-11-16T22:01:51-08:00',
  			trashed_at: null,
  			purged_at: null,
  			content_created_at: '2016-10-29T18:33:50-07:00',
  			content_modified_at: '2016-10-29T18:33:50-07:00',
  			created_by: 
  			{ type: 'user',
  				id: '44444',
  				name: 'Owner',
  				login: 'owner@example.com' },
  			modified_by: 
  			{ type: 'user',
  				id: '44444',
  				name: 'Owner',
  				login: 'owner@example.com' },
  			owned_by: 
  			{ type: 'user',
  				id: '44444',
  				name: 'Owner',
  				login: 'owner@example.com' },
  			shared_link: null,
  			parent: 
  			{ type: 'folder',
  				id: '33333',
  				sequence_id: '0',
  				etag: '0',
  				name: 'Collaborated Folder' },
  			item_status: 'active' }

  		*/
  	});
  ```
</CodeGroup>

## ファイルID

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

## その他のフィールド

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

<Card href={localizeLink("/guides/api-calls/request-extra-fields")} arrow title="追加フィールドのリクエストについて確認する" />

<RelatedLinks
  title="関連するAPI"
  items={[
{ label: translate("Get file information"), href: "/reference/get-files-id", badge: "GET" }
]}
/>

<RelatedLinks
  title="関連するガイド"
  items={[
{ label: translate("Download File"), href: "/guides/downloads/file", badge: "GUIDE" }
]}
/>
