> For the complete documentation index, see [llms.txt](https://docs.nexthink.com/platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nexthink.com/platform/ja/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/api-and-integrations-classic/other-integrations-classic/triggering-remote-actions-via-their-api-classic.md).

# リモートアクションAPIによるトリガー(クラシック)

この記事で説明されているいくつかの機能は、Finder (クラシック) に関連しています

{% ヒントのスタイル="情報" %}

Nexthink Finderは、Windows専用のデスクトップアプリケーションで、その機能は現在NexthinkのWebインターフェース内で利用可能です。 Nexthinkは現在ブラウザから直接使用可能であり、ほとんどの機能は追加のデスクトップアプリケーションなしで利用できます。

Nexthink ActのAPIを使用することで、プログラム的にリモートアクションをトリガーし、セルフサービスポータルやチケッティングシステムなどのサードパーティ製品と統合することが可能になります。

リモートアクションのAPIはNexthink WebインターフェースによってREST APIとして公開されています。 現在の記事はAct API v2を文書化しています。

## 前提条件 <a href="#triggeringremoteactionsviatheirapi-classic-prerequisites" id="triggeringremoteactionsviatheirapi-classic-prerequisites"></a>

Act APIを通してリモートアクションをトリガーするには、以下の前提条件が適用されます:

* リモートアクションは手動でトリガーできます。
* リモートアクションは、Finderへのアクセスを含むプロフィールにユーザーが代わってトリガーされ、**リモートアクションのAPIを許可する**オプションがオンになっています。

## Act APIを呼び出す <a href="#triggeringremoteactionsviatheirapi-classic-callingtheactapi" id="triggeringremoteactionsviatheirapi-classic-callingtheactapi"></a>

Nexthink Webインターフェースは、以下のURLでAct APIをREST APIとして公開しています:

`https://[portal.company.com]/api/remoteaction/v2/run`

URLでは、\[portal.company.com]をNexthink Webインターフェースの外部DNS名に置き換えてください。

\nリモートアクションをトリガーするには、APIのURLにPOSTリクエストを送信してください（なお、GETリクエストはサポートされておらず、404エラーを返します）。JSONペイロードに2つのパラメータを含めます:

| 名前                   | 説明                                                                       |
| -------------------- | ------------------------------------------------------------------------ |
| `requestUid`         | （任意）ロギング目的のリクエストの識別子。                                                    |
| `remoteActionUid`    | リモートアクションの識別子。                                                           |
| `deviceUids`         | ターゲットにするデバイス識別子のリスト。                                                     |
| `engineDatabaseUids` | （任意）ターゲットにするエンジン識別子のリスト。                                                 |
| `timeoutSeconds`     | （任意）秒単位のリクエストタイムアウト。 Nexthink Webインターフェイスで構成されたデフォルトのタイムアウト（60秒）を上書きします。 |
| `params​`            | （任意）パラメータの入力と値のリスト​。 不明なパラメータ名は無視されます。                                   |

呼び出しは、Nexthink Webインターフェイスに接続されているすべてのエンジンまたは指定されたエンジンのみに送信され、ターゲットエンジンからの応答を受信するとNexthink Webインターフェイスで戻されるか、指定されたタイムアウトが経過したときに戻されます。 Nexthink Webインターフェイスからの成功した応答が選択したデバイスにリモートアクションが実行されることを保証するものではありません（エンジン応答のコード一覧を参照してください）。

#### Finder からリモートアクション、デバイス、およびエンジンの UID を取得する <a href="#triggeringremoteactionsviatheirapi-classic-obtainingtheuidsofremoteactions-devicesandenginesfromfind" id="triggeringremoteactionsviatheirapi-classic-obtainingtheuidsofremoteactions-devicesandenginesfromfind"></a>

リモートアクションの UID を取得するには:

1. Finderにリモートアクションを編集する権限を持つユーザーとしてログインします。
2. 左側のメニューの**リモートアクション**セクションで目的のリモートアクションを見つけます。
3. リモートアクション名を右クリックします。
4. **エクスポート > リモートアクション UID をクリップボードにコピー** を選択します。
5. リクエストエディタで、**Ctrl+V** を押して JSON ペイロードに UID を貼り付けます。

デバイスの UID を見つけるには、次のいずれかを使用します:

* Finder: デバイスオブジェクトの **UID** フィールドを表示します。
* NXQL: デバイスオブジェクトの **device\_uid** フィールドを取得します。たとえば、

`(select device_uid (from device))`

特定のエンジンをターゲットにするには、各エンジンのデータベースの UID を [List Engines API](/platform/ja/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/api-and-integrations-classic/other-integrations-classic/list-engines-api-classic.md) から取得します。

#### HTTP ヘッダー <a href="#triggeringremoteactionsviatheirapi-classic-httpheaders" id="triggeringremoteactionsviatheirapi-classic-httpheaders"></a>

リモートアクションのAPIにPOSTリクエストを送信し、JSONコンテンツと基本認証を指定する次のHTTPヘッダーを指定します：

`Content-type: application/json`

`Authorization: Basic [base-64(user:password)]`

\[base-64(user:password)] を、リモートアクションのAPIへのアクセス権を持つNexthinkユーザーの資格情報（base-64エンコーディング）に置き換えてください。

## 応答 <a href="#triggeringremoteactionsviatheirapi-classic-response" id="triggeringremoteactionsviatheirapi-classic-response"></a>

#### 成功した応答 <a href="#triggeringremoteactionsviatheirapi-classic-successfulresponse" id="triggeringremoteactionsviatheirapi-classic-successfulresponse"></a>

成功した場合、Act API v2 への呼び出しは、HTTP コード 200 とともに、対象となる各エンジンからの応答リストを返します。

| 名前            | 説明                                                                                                                                                                       |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `databaseUid` | ターゲットエンジンの識別子                                                                                                                                                            |
| `code`        | <ul><li>ok</li><li>timeout</li><li>engine\_error</li><li>not\_connected</li><li>unknownエラー<code>databaseUid</code></li><li>no\_permissionユーザーはエンジンへの許可を持っていません</li></ul> |
| `お問い合わせ詳細`    | エンジンからの追加のメッセージの可能性                                                                                                                                                      |

### エラー応答 <a href="#triggeringremoteactionsviatheirapi-classic-errorresponse" id="triggeringremoteactionsviatheirapi-classic-errorresponse"></a>

失敗した場合、Act API v2 への呼び出しは、エラーの種類に応じた HTTP コードのエラー応答を返します。

| 名前      | 説明                                    |          |
| ------- | ------------------------------------- | -------- |
| `code`  | エラーコードのいずれか:                          | HTTP コード |
|         | INVALID\_REQUEST\_JSON                | 400      |
|         | INVALID\_REQUEST\_CONTENT             | 400      |
|         | INTERNAL\_ERROR                       | 500      |
|         | CONTENT\_TYPE                         | 400      |
|         | ENCODING                              | 400      |
|         | NO\_REMOTE\_ACTION\_UID               | 400      |
|         | NO\_DEVICES                           | 400      |
|         | TOO\_MANY\_DEVICES                    | 400      |
|         | INVALID\_ACTION\_UID                  | 400      |
|         | INVALID\_DEVICE\_UID                  | 400      |
|         | NO\_PERMISSION                        | 403      |
|         | UNKNOWN\_OR\_DISABLED\_REMOTE\_ACTION | 400      |
|         | NO\_MANUAL\_EXECUTION                 | 400      |
|         | NO\_ENGINES\_TO\_TARGET               | 403      |
| `error` | エラーコードの説明。                            |          |

## 例 <a href="#triggeringremoteactionsviatheirapi-classic-examples" id="triggeringremoteactionsviatheirapi-classic-examples"></a>

### すべてのエンジンをターゲットにする <a href="#triggeringremoteactionsviatheirapi-classic-targetallengines" id="triggeringremoteactionsviatheirapi-classic-targetallengines"></a>

すべてのエンジンをターゲットにしたリクエストとその応答のJSON形式の例。

```
//リクエスト
{
 "requestUid": "123",
 "remoteActionUid": "07844969-1889-4de3-9026-020af94be855",
 "deviceUids": ["da2add909a144e8235453f88dc45172f","4423e4c059b2c72ee9382e135888bef7",
 "13ea2b236e6833ffe6045a7715968cba","3537e2f2eb0d5f2152da59e7cbcb505b"]
}


// 応答
// ステータス 200
// 本文:
[
    {
 "databaseUid": "86acc8511251ec444d3a75bac33a23c7",
 "code": "ok",
 "message": ""
    },
    {
 "databaseUid": "a4690014774dcc32b919c27d616166f7",
 "code": "ok",
 "message": ""
    },
    {
 "databaseUid": "ce80dddfdb7a5c2346c4ac184b7d6a54",
 "code": "engine_error",
 "message": "エンジンへのリクエスト[172.16.5.177:999]でエラー：ライセンスがありません"
    }
]
```

### 一つのエンジンをターゲットにする <a href="#triggeringremoteactionsviatheirapi-classic-targetoneengine" id="triggeringremoteactionsviatheirapi-classic-targetoneengine"></a>

一つのエンジンをターゲットにしたリクエストとその応答のJSON形式の例。

```
//リクエスト
{
 
 "requestUid": "123",
 "remoteActionUid": "07844969-1889-4de3-9026-020af94be855",
 "deviceUids": ["da2add909a144e8235453f88dc45172f","4423e4c059b2c72ee9382e135888bef7",
 "13ea2b236e6833ffe6045a7715968cba","3537e2f2eb0d5f2152da59e7cbcb505b"],
 "engineDatabaseUids" : ["a4690014774dcc32b919c27d616166f7"]
}
 
// 応答
// ステータス 200
// 本文:
[
    {
 "databaseUid": "a4690014774dcc32b919c27d616166f7",
 "code": "ok",
 "message": ""
    }
]
```

### エラー応答 <a href="#triggeringremoteactionsviatheirapi-classic-errorresponse.1" id="triggeringremoteactionsviatheirapi-classic-errorresponse.1"></a>

手動実行が無効なためにエラーを返すリクエストの例。

```
// リクエスト
{
 "requestUid": "123",
 "remoteActionUid": "e6bb97be-0957-49e0-9922-1a684d093858",
 "deviceUids": ["da2add909a144e8235453f88dc45172f","4423e4c059b2c72ee9382e135888bef7",
 "13ea2b236e6833ffe6045a7715968cba","3537e2f2eb0d5f2152da59e7cbcb505b"]
}
 
 
// 応答
// ステータス 400
// 本文:
{
 "code": "NO_MANUAL_EXECUTION",
 "error": "手動実行用に構成されていないリモートアクション"
}
```

***

関連タスク

* [リモートアクションを手動でトリガーする](/platform/ja/user-guide/remote-actions/remote-actions-in-finder-classic/triggering-a-remote-action-manually-with-finder-classic.md)

関連するリファレンス

* [List Engines API](/platform/ja/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/api-and-integrations-classic/other-integrations-classic/list-engines-api-classic.md)


---

# 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.nexthink.com/platform/ja/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/api-and-integrations-classic/other-integrations-classic/triggering-remote-actions-via-their-api-classic.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.
