> For the complete documentation index, see [llms.txt](https://docs.scepman.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scepman.com/ja/zheng-ming-shu-guan-li/management-rest-api.md).

# 管理用 REST API

{% hint style="warning" %}
SCEPman Enterprise Edition のみ

バージョン 3.1 以降に適用されます
{% endhint %}

Management API は、SCEPman の発行済み証明書への管理アクセスを提供します。これは、証明書の検索や必要に応じた失効など、管理および運用ワークフローを目的としています。

これらのエンドポイントは次の下で利用できます `/api/manage` そして、次のロールを持つ認証済みユーザーが必要です **Manage.All** SCEPman-api のロール。

{% hint style="info" %}
以前の SCEPman バージョンから更新した場合、まだ Manage.All ロールを持っていない可能性があります。 `Complete-SCEPmanInstallation` を Cloud Shell で再度実行して、それを SCEPman-api アプリケーションに自動的に追加してください。
{% endhint %}

### 認証

この API は Entra 認証を使用します。認証する最も簡単な方法は、多くの場合 Microsoft Authentication Library (MSAL) です。

Management API 用のベアラートークンを取得する方法の 1 つは、Azure CLI を使うことです。\`--resource\` パラメーターに必要な値は、SCEPman-api アプリ登録の Application ID URI です（通常は、その Application ID の前に `api://`).

```bash
az account get-access-token --resource api://[APPLICATION-ID] --query accessToken --output tsv
```

たとえば:

```bash
TOKEN=$(az account get-access-token \
  --resource api://16b6a4d1-0a20-4b41-bf58-12783034cad3 \
  --query accessToken \
  --output tsv)
```

その後、そのトークンを API 呼び出しで使用できます:

```bash
curl -X GET "https://scepman.contoso.com/api/manage/search?searchText=ABC123&pageSize=10&certValidity=Any&certType=Any" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json"
```

### 検索 API

**`GET /api/manage/search`**

発行済み証明書を検索し、ページ分割された結果セットを返します。

#### 検索パラメーター

**`searchText`**

一致する証明書を見つけるための自由入力検索語です。これは通常、部分文字列ベースの検索、たとえば要求者やその他の検索可能な証明書メタデータの一致確認に使用されます。

**`pageSize`**

1 回の応答ページで返される証明書の最大数。

* 既定: 50

**`continuationToken`**

次の結果ページを要求するために使用する、オプションのページネーション トークン。\
前回の検索応答から返された `continuationToken` ものを返して、さらに証明書の取得を続行します。

**`certValidity`**

証明書を有効性の状態でフィルターします。

* デフォルト: `Any`

有効な値は `Any`, `Active`, `期限切れ`, `Revoked`.

**`certType`**

証明書を証明書の種類でフィルターします。

* デフォルト: `Any`

これは、結果セットを特定の証明書カテゴリに制限するために使用できます。有効な値は `Static`, `DC`, `ユーザー`, `デバイス`、および `Any`.

**`ソース`**

証明書を、それらが発行されたエンドポイントでフィルターします。このフィルターは、ソースごとに 1 回ずつ、複数回指定できます。

* 既定: 制限なし

有効な値は下の表に示されています。ソースは整数値を使用して指定する必要があります:

| ソース               | Value                           |
| ----------------- | ------------------------------- |
| CertificateMaster | 0                               |
| Intune            | 1 または 9（すべてを見つけるために両方を使用してください） |
| Static            | 3                               |
| StaticAAD         | 4                               |
| Jamf              | 5                               |
| DomainController  | 6                               |
| API               | 7                               |
| RadiusAPI         | 8                               |
| Active Directory  | 10                              |

応答は、証明書レコードのページ分割された一覧と、次のページを取得するための continuation token で構成されます。

**例**

```bash
curl -X GET "https://scepman.contoso.com/api/manage/search?searchText=507AEAC03CCEF83F106914418D9222E466A629C1&pageSize=10&certValidity=Any&certType=Any" \
  -H "Authorization: Bearer <token>" \
  -H "Accept: application/json"
```

**応答例**

```json
{
  "items": [
    {
    "serialNumber":  "507AEAC03CCEF83F106914418D9222E466A629C1",
    "subject":  "CN=device01.contoso.local",
    "sans":  null,
    "upn":  null,
    "issuanceDate":  "2026-05-28T10:57:22Z",
    "expirationDate":  "2028-05-28T10:57:22Z",
    "revocationDate":  null,
    "revocationReason":  null,
    "revokedBy":  null,
    "requester":  "pkiAdmin@contoso.com",
    "source":  "CertificateMaster",
    "certificateType":  "Static"
    }
  ],
  "continuationToken": "..."
}
```

### **失効 API**

**`PATCH /api/manage/revoke/{serialNumber}`**

シリアル番号で識別される証明書を失効させます。

要求本文には次が含まれます:

* `revocationReason` - 失効理由を表す整数です。可能な値については下の表を参照してください
* `revoker` *（任意）* - 失効を要求する人物またはシステムを示す自由入力の識別子

{% hint style="info" %}
指定する場合は、revoker フィールドには UPN を使用することを推奨します。指定しない場合は、ログオン中のユーザーの UPN が使用されます。指定した場合でも、ログオン中のユーザーの UPN は "{revoker} through API user ${logged on user}" の形式で追加されます。

この値は監査と検索に使用されます。
{% endhint %}

**例**

```bash
curl -X PATCH "https://scepman.contoso.com/api/manage/revoke/ABC123" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "revocationReason": 4,
    "revoker": "pkiAdmin@contoso.com"
  }'
```

**成功応答**

```http
HTTP/1.1 200 OK
```

**証明書が見つかりません**

```http
HTTP/1.1 404 Not Found
Content-Type: application/json
```

```json
{
  "errorMessage": "証明書が見つかりません。",
  "errorCode": 7012
}
```

**既に失効済み**

```http
HTTP/1.1 409 Conflict
Content-Type: application/json
```

```json
{
  "errorMessage": "その証明書はすでに失効しています。",
  "errorCode": 5013
}
```

#### サポートされる失効理由

この API は、RFC 5280 で規定されている失効理由をサポートします [RFC 5280](https://datatracker.ietf.org/doc/html/rfc5280#section-5.3.1):

| Value | 失効理由     |
| ----- | -------- |
| 0     | 未指定      |
| 1     | 鍵漏えい     |
| 2     | CA 侵害    |
| 3     | 所属変更     |
| 4     | 置換済み     |
| 5     | 運用停止     |
| 6     | 証明書保留    |
| 8     | CRL から削除 |
| 9     | 権限撤回     |
| 10    | AA 侵害    |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.scepman.com/ja/zheng-ming-shu-guan-li/management-rest-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
