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

# Hubのリストの取得

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 = localizeLink(href);
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

Box Hubのリストを取得する方法は、次の2とおりあります。

* [リクエストしているユーザーのすべてのHub](#list-hubs-for-the-requesting-user)
* [企業のすべてのHub](#list-hubs-for-the-enterprise)

クエリパラメータを使用すると、結果の検索、スコープによる絞り込み、並べ替えが可能です。

<Warning>Box Hubs endpoints require the `box-version: 2025.0 header`. If you omit this header, the API returns a 400 error with the message `Missing required box-version header. Supported API versions: [2025.0].` For more information, see [Box API versioning strategy](/guides/api-calls/api-versioning-strategy/).</Warning>

## リクエストしているユーザーのHubのリストを取得

認証済みユーザーがアクセスできるすべてのBox Hubを取得するには、<Link href="/reference/v2025.0/get-hubs">`GET /2.0/hubs`</Link>エンドポイントを呼び出します。

<CodeGroup>
  ```sh Box CLI theme={null}
  box hubs --scope all --sort name --direction ASC
  ```

  ```sh cURL theme={null}
  curl -i -X GET "https://api.box.com/2.0/hubs?scope=all&sort=name&direction=ASC" \
       -H "Authorization: Bearer <ACCESS_TOKEN>" \
       -H "box-version: 2025.0"
  ```

  ```typescript Node/TypeScript v10 theme={null}
  await client.hubs.getHubsV2025R0({
    scope: 'all',
    sort: 'name',
    direction: 'ASC' as GetHubsV2025R0QueryParamsDirectionField,
  } satisfies GetHubsV2025R0QueryParams);
  ```

  ```python Python v10 theme={null}
  client.hubs.get_hubs_v2025_r0(scope="all", sort="name", direction=GetHubsV2025R0Direction.ASC)
  ```

  ```csharp .NET v10 theme={null}
  await client.Hubs.GetHubsV2025R0Async(queryParams: new GetHubsV2025R0QueryParams() { Scope = "all", Sort = "name", Direction = GetHubsV2025R0QueryParamsDirectionField.Asc });
  ```

  ```swift Swift v10 theme={null}
  try await client.hubs.getHubsV2025R0(queryParams: GetHubsV2025R0QueryParams(scope: "all", sort: "name", direction: GetHubsV2025R0QueryParamsDirectionField.asc))
  ```

  ```java Java v10 theme={null}
  client.getHubs().getHubsV2025R0(new GetHubsV2025R0QueryParams.Builder().scope("all").sort("name").direction(GetHubsV2025R0QueryParamsDirectionField.ASC).build());
  ```
</CodeGroup>

### クエリパラメータ (ユーザーのHubのリストを取得)

| パラメータ       | 型       | 必須  | 説明                                                                                         |
| ----------- | ------- | --- | ------------------------------------------------------------------------------------------ |
| `query`     | string  | いいえ | Box Hubsの検索文字列。                                                                            |
| `scope`     | string  | いいえ | `editable`、`view_only`、または`all`。デフォルトは`all`。                                               |
| `sort`      | string  | いいえ | `name`、`updated_at`、`last_accessed_at`、`view_count`、または`relevance`で並べ替え。デフォルトは`relevance`。 |
| `direction` | string  | いいえ | `ASC`または`DESC`。                                                                            |
| `marker`    | string  | いいえ | マーカーベースのページネーション用のマーカー。                                                                    |
| `limit`     | integer | いいえ | 1ページあたりの最大項目数 (1000以下にしてください)。                                                             |

## 企業のHubのリストを取得

<Link href="/guides/api-calls/permissions-and-errors/scopes/#global-content-manager-gcm">グローバルコンテンツマネージャ (GCM)</Link> スコープが設定されている、企業の管理者またはHub共同管理者は、<Link href="/reference/v2025.0/get-enterprise-hubs">`GET /2.0/enterprise_hubs`</Link>エンドポイントを使用して、企業のすべてのBox Hubのリストを取得できます。

<CodeGroup>
  ```sh Box CLI theme={null}
  box hubs:enterprise --sort name --direction ASC
  ```

  ```sh cURL theme={null}
  curl -i -X GET "https://api.box.com/2.0/enterprise_hubs?scope=all&sort=name&direction=ASC" \
       -H "Authorization: Bearer <ACCESS_TOKEN>" \
       -H "box-version: 2025.0"
  ```

  ```typescript Node/TypeScript v10 theme={null}
  await client.hubs.getEnterpriseHubsV2025R0({
    scope: 'all',
    sort: 'name',
    direction: 'ASC' as GetEnterpriseHubsV2025R0QueryParamsDirectionField,
  } satisfies GetEnterpriseHubsV2025R0QueryParams);
  ```

  ```python Python v10 theme={null}
  client.hubs.get_enterprise_hubs_v2025_r0(scope="all", sort="name", direction=GetEnterpriseHubsV2025R0Direction.ASC)
  ```

  ```csharp .NET v10 theme={null}
  await client.Hubs.GetEnterpriseHubsV2025R0Async(queryParams: new GetEnterpriseHubsV2025R0QueryParams() { Scope = "all", Sort = "name", Direction = GetEnterpriseHubsV2025R0QueryParamsDirectionField.Asc });
  ```

  ```swift Swift v10 theme={null}
  try await client.hubs.getEnterpriseHubsV2025R0(queryParams: GetEnterpriseHubsV2025R0QueryParams(scope: "all", sort: "name", direction: GetEnterpriseHubsV2025R0QueryParamsDirectionField.asc))
  ```

  ```java Java v10 theme={null}
  client.getHubs().getEnterpriseHubsV2025R0(new GetEnterpriseHubsV2025R0QueryParams.Builder().scope("all").sort("name").direction(GetEnterpriseHubsV2025R0QueryParamsDirectionField.ASC).build());
  ```
</CodeGroup>

どちらのエンドポイントも、ページネーションフィールド (`limit`、`next_marker`) とともにHubのリストを返します。パラメータの詳細な説明と制限事項については、APIリファレンスを参照してください。

<RelatedLinks
  title="関連するAPI"
  items={[
{ label: translate("List hubs"), href: "/reference/v2025.0/get-hubs", badge: "GET" },
{ label: translate("List enterprise hubs"), href: "/reference/v2025.0/get-enterprise-hubs", badge: "GET" },
{ label: translate("Get hub by ID"), href: "/reference/v2025.0/get-hubs-id", badge: "GET" }
]}
/>

<RelatedLinks
  title="関連するガイド"
  items={[
{ label: translate("Box Hubs overview"), href: "/guides/hubs-api", badge: "GUIDE" },
{ label: translate("Create a hub"), href: "/guides/hubs-api/hubs/create-hub", badge: "GUIDE" }
]}
/>
