# 同じURL上の複数のOpenAPI仕様

Aikido の各 REST API ドメインには 1 つの OpenAPI スペックがあり、各ドメイン URL は一意である必要があります。複数のサービスが同じベース URL の背後にあり、それぞれに独自のスペックがある場合は、同じ URL をスペックごとに 1 回ずつ追加し、次のような名前付き URL フラグメントで各エントリを一意にしてください。 `#orders` または `#billing`.

## 仕組み

URL フラグメントは、次の記号の後ろの部分です `#`。ブラウザや HTTP クライアントはそれをサーバーに送信しません。Aikido では `https://staging.example.com/api#orders` と `https://staging.example.com/api#billing` 2 つの別々のドメインとして扱いますが、両方からのすべてのスキャン要求は `https://staging.example.com/api`.

| Aikido のドメイン                              | OpenAPI スペック           | リクエスト先                            |
| ----------------------------------------- | ---------------------- | --------------------------------- |
| `https://staging.example.com/api#orders`  | `orders-openapi.json`  | `https://staging.example.com/api` |
| `https://staging.example.com/api#billing` | `billing-openapi.json` | `https://staging.example.com/api` |

## 同じ URL にスペックを追加

1. 次へ移動します： [ドメイン](https://app.aikido.dev/domains) に移動し、 **ドメインを追加**.
2. 展開 **Advanced** and select **REST API**.
3. サービス名にちなんだフラグメントを付けたベース URL を入力してください。例: `https://staging.example.com/api#orders`.
4. このサービスの OpenAPI スペックを追加します。詳細は [REST APIとWebアプリのスキャン](https://help.aikido.dev/docs/docs-ja/dast-surface-monitoring/api-scanning/rest-api-scanning) スペックのオプションをご覧ください。
5. 新しいフラグメント名で繰り返します。例: `#billing`、追加のスペックごとに。

{% hint style="info" %}
認証と [追加ヘッダー](https://help.aikido.dev/docs/docs-ja/dast-surface-monitoring/api-scanning/add-additional-headers-in-api-scanning) はドメインごとに設定されます。必要なすべてのフラグメントドメインで設定してください。
{% endhint %}

## 関連

{% content-ref url="rest-api-scanning.md" %}
[REST APIとWebアプリのスキャン](https://help.aikido.dev/docs/docs-ja/dast-surface-monitoring/api-scanning/rest-api-scanning)
{% endcontent-ref %}

{% content-ref url="authenticated-api-scanning-for-rest-graphql.md" %}
[REST/GraphQL向け認証済みAPIスキャン](https://help.aikido.dev/docs/docs-ja/dast-surface-monitoring/api-scanning/authenticated-api-scanning-for-rest-graphql)
{% endcontent-ref %}
