> 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/guan-li-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 のベアラートークンを取得する方法の一つは 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`, `Expired`, `Revoked`.

**`certType`**

証明書を証明書タイプでフィルターします。

* 既定: `Any`

これを使用すると、結果セットを特定の証明書カテゴリに制限できます。有効な値は次のとおりです `Static`, `DC`, `User`, `Device`、および `Any`.

**`Sources`**

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

* 既定: 制限なし

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

| ソース               | 値                                 |
| ----------------- | --------------------------------- |
| 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": "Certificate not found.",
  "errorCode": 7012
}
```

**すでに失効済み**

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

```json
{
  "errorMessage": "The certificate is already revoked.",
  "errorCode": 5013
}
```

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

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

| 値  | 失効理由                 |
| -- | -------------------- |
| 0  | Unspecified          |
| 1  | KeyCompromise        |
| 2  | CACompromise         |
| 3  | AffiliationChanged   |
| 4  | Superseded           |
| 5  | CessationOfOperation |
| 6  | CertificateHold      |
| 8  | RemoveFromCrl        |
| 9  | PrivilegeWithdrawn   |
| 10 | AACompromise         |


---

# 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/guan-li-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.
