> For the complete documentation index, see [llms.txt](https://help.autify.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.autify.com/nocode-web/autify-university/integrations/integrate-with-api.md). Agents can also search and read this documentation through its [MCP server](https://help.autify.com/~gitbook/mcp).

# API連携

## Autify API

{% hint style="info" %}
**API の仕様は、**[**Autify のOpenAPI 定義**](https://autifyhq.github.io/autify-api/#/) **(英語のみ)をご覧下さい。** **なお、CI/CD 連携については、Autify の公式連携のご利用を強くお勧めします。**[**Autify でCI/CD**](https://help.autify.com/nocode-web/autify-university/integrations/cicd-with-autify.md) **をご覧下さい。**
{% endhint %}

Autify は API を提供しています。

API をご利用いただくことで CircleCI や Jenkins といった CI/CD ツールと連携することができ、ソースコードがマージされたタイミングで自動的に特定のテストプランを実行する、といったように、開発フローに組み込むことができます。

## パーソナルアクセストークンの発行 <a href="#issue-a-personal-access-token" id="issue-a-personal-access-token"></a>

API を実行するためには、パーソナルアクセストークンが必要となりますので、これを予め発行してください。 アクセストークンはユーザー単位での生成となるため、共用にしたい場合は、API専用のユーザーを作成することをおすすめします！

パーソナルアクセストークンは、サイドメニューの「設定」から「個人設定」を開き、その中の「新しいパーソナルアクセストークンを生成」から生成することができます。

![](https://50135409-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fof7cb8AGXhWvWThq3R0w%2Fuploads%2Fgit-blob-a1d6d05eadc15c233f2392f04f775ec42f2dfee0%2Fzndsk-Screen_Shot_2021-09-14_at_17.13.01.png?alt=media)

## Autify APIの活用

### Autify CLI を使って

[Autify Command Line Interface (CLI)](https://help.autify.com/nocode-web/autify-university/integrations/autify-command-line-interface.md) は各Autify API に対してローレベルのコマンドを提供しているので、シェルスクリプト等を使って自由なソリューションを簡単に組み上げることができます。

{% hint style="info" %}
Autify CLI は、複雑なユースケースに対して効率的なユーザ体験を提供するために、`autify web test run` の様なハイレベルのコマンドをいくつか持っています。Autify API を直接呼び出してご自身でソリューションを作る前に、**まずはこれらのハイレベルのコマンドが使えないかを検討してみてください。**
{% endhint %}

Autify CLI を使ったいくつかの例です:

#### シナリオIDと実行環境 (capabilities) を指定して、テストを実行する

```sh-session
$ autify web api execute-scenarios --project-id 0 --execute-scenarios-request '{
  "scenarios": [{"id": 111}],
  "capabilities": [{"os": "Linux", "browser": "Chrome"}]
}'

{
  "result_id": 222
}
```

#### テスト結果IDを指定して、テスト結果の詳細を取得する

```
$ autify web api describe-result --project-id 0 --result-id 222
{
  "id": 222,
  "status": "passed",
  "review_needed": false,
  "test_plan_capability_results": [
    {
      "id": 333,
      "capability": {
        "os": "Linux",
        "browser": "Chrome",
        ...
      },
      "test_case_results": [
        {
          "id": 444,
          "status": "passed",
          "project_url": "https://app.autify.com/...",
          "review_needed": 0,
          ...
        }
      ]
    }
  ],
  ...
}
```

詳しくは、[GitHub readme](https://github.com/autifyhq/autify-cli#commands) の`autify web api` コマンド群をご覧下さい。

### ご自身の HTTP クライアントを使って

{% hint style="warning" %}
もしAutify CLI が利用可能な環境でしたら、上記のAutify CLI バージョンのご利用を強くお勧めします。

もしSDK や公式サポートが必要でしたら、[GitHub Issues](https://github.com/autifyhq/autify-cli/issues) でリクエストをして下さい。
{% endhint %}

もし、`curl` などご自身のHTTP クライアントからAutify API 連携したい場合には、そのクライアントから以下の様なHTTP リクエストを送れる様に設定して下さい:

#### シナリオIDと実行環境 (capabilities) を指定して、テストを実行する

```
POST /projects/0/execute_scenarios HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json
Authorization: Bearer YOUR_PERSONAL_ACCESS_TOKEN
Content-Length: 77
Host: app.autify.com

{"scenarios":[{"id":111}],"capabilities":[{"os":"Linux","browser":"Chrome"}]}
```

#### テスト結果IDを指定して、テスト結果の詳細を取得する

```
GET /projects/0/results/222 HTTP/1.1
Accept: application/json, text/plain, */*
Authorization: Bearer YOUR_PERSONAL_ACCESS_TOKEN
Host: app.autify.com
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.autify.com/nocode-web/autify-university/integrations/integrate-with-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
