> ## 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.

# Request extra fields

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>;
};

export const Link = ({href, children, className, ...props}) => {
  const [localizedHref, setLocalizedHref] = useState(href);
  const supportedLocales = useMemo(() => ['ja'], []);
  useEffect(() => {
    const getLocaleFromPath = path => {
      const match = path.match(/^\/([a-z]{2})(?:\/|$)/);
      if (match) {
        const potentialLocale = match[1];
        if (supportedLocales.includes(potentialLocale)) {
          return potentialLocale;
        }
      }
      return null;
    };
    const hasLocalePrefix = path => {
      const match = path.match(/^\/([a-z]{2})(?:\/|$)/);
      return match ? supportedLocales.includes(match[1]) : false;
    };
    const currentPath = window.location.pathname;
    const currentLocale = getLocaleFromPath(currentPath);
    if (href && href.startsWith('/') && !hasLocalePrefix(href)) {
      if (currentLocale) {
        setLocalizedHref(`/${currentLocale}${href}`);
      } else {
        setLocalizedHref(href);
      }
    } else {
      setLocalizedHref(href);
    }
  }, [href, supportedLocales]);
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

The number of fields returned for a resource depends on the API endpoint used
to request the resource.

## Use the `fields` query parameter

To request a specific field for a resource that is not returned by default in
the standard response, append the `fields` query parameter to your request. The
value of this parameter is a comma separated list of field names.

```sh  theme={null}
curl https://api.box.com/2.0/files/12345?fields=is_package,lock \
    -H "authorization: Bearer ACCESS_TOKEN"
```

```json  theme={null}
{
  "etag": "1",
  "id": "12345",
  "is_package": false,
  "lock": null,
  "type": "file"
}
```

<Note>
  It is important to note that when a specific field is requested no other
  fields are returned except for those requested and the **base** set of fields.
  For a file, this base set is comprised of the `etag`, `id`, and `type` values.
</Note>

## Resource variants

The following resource variants are available in the Box API.

### Standard

The default set of fields returned in an API response.
The standard variant is returned when requesting a resource
through the main APIs available for that resource. For example, when requesting
the <Link href="/reference/get-files-id">`GET /files/:id`</Link> endpoint the API will return
the standard variation of a file.

```sh  theme={null}
curl https://api.box.com/2.0/files/12345 \
    -H "authorization: Bearer ACCESS_TOKEN"
```

```json  theme={null}
{
    "content_created_at": "2019-06-20T06:04:41-07:00",
    "content_modified_at": "2019-06-20T06:04:41-07:00",
    "created_at": "2019-06-20T07:28:42-07:00",
    "created_by": {
        "id": "191919191",
        "login": "joe@example.com",
        "name": "Joe Box",
        "type": "user"
    },
    "description": "",
    "etag": "1",
    "file_version": {
        "id": "56663434454334",
        "sha1": "585afa5209bbd586c79499b7336601341ad06cce",
        "type": "file_version"
    },
    "id": "12345",
    ...
    "size": 65000647,
    "trashed_at": null,
    "type": "file"
}
```

### Mini

Where a resource is returned as a nested part of another response it is often
reduced in size, only returning some of the more essential fields. This variant
is commonly known as the mini resource variant.

For example, when requesting the
<Link href="/reference/get-folders-id-items">`GET /folders/:id/items`</Link> endpoint the API
will return a mini variation of files and folders nested within the `item_collection`.

```sh  theme={null}
curl https://api.box.com/2.0/files/12345 \
    -H "authorization: Bearer ACCESS_TOKEN"
```

```json  theme={null}
{
  "id": "0",
  "type": "folder",
  "item_collection": {
    "entries": [
      {
        "etag": "1",
        "file_version": {
          "id": "56663434454334",
          "sha1": "585afa5209bbd586c79499b7336601341ad06cce",
          "type": "file_version"
        },
        "id": "12345",
        "name": "Video.mp4",
        "sequence_id": "1",
        "sha1": "585afa5209bbd586c79499b7336601341ad06cce",
        "type": "file"
      }
      ...
    ]
    ...
  }
  ...
}
```

<Note>
  To request more information for a nested resource we recommend calling the
  API for that resource to request it by ID, and optionally pass along the
  `field` query parameter.

  For example, to get the owner of a file returned when listing the items in a
  folder, request that file by ID with the query parameter `field=owned_by`.
</Note>

### Full

The total set of fields that can be returned in an API response. The full variant is returned when requesting a resource
through the main APIs available for that resource and by appending the `fields`
query parameter.

For example, when requesting the <Link href="/reference/get-files-id">`GET /files/:id`</Link>
endpoint with the `fields=is_package,lock` parameter the API will return the fields specified plus the basic fields for the file.

```sh  theme={null}
curl https://api.box.com/2.0/files/12345?fields=is_package,lock \
    -H "authorization: Bearer ACCESS_TOKEN"
```

```json  theme={null}
{
  "etag": "1",
  "id": "12345",
  "is_package": false,
  "lock": null,
  "type": "file"
}
```

<RelatedLinks
  title="RELATED APIS"
  items={[
  { label: "Get file information", href: "/reference/get-files-id", badge: "GET" },
  { label: "Get folder information", href: "/reference/get-folders-id", badge: "GET" },
  { label: "List items in folder", href: "/reference/get-folders-id-items", badge: "GET" },
  { label: "Get user", href: "/reference/get-users-id", badge: "GET" }
]}
/>
