> ## Documentation Index
> Fetch the complete documentation index at: https://docs.morph-data.io/llms.txt
> Use this file to discover all available pages before exploring further.

# APIエンドポイントを利用する

<Warning>
  可能であればデータコンポーネントを使うことを強くおすすめします。データアプリで必要とされるコンポーネントが網羅されており、積極的にメンテナンスされています。

  また、マークダウンファイル内では、 `loadData` `postData` 関数を使うことができます。
</Warning>

Morphで構築したPythonスクリプトをAPIとして利用することもできます。Python関数に付与した[エイリアス](/docs/ja/develop/guides/alias)を使って以下のルールでAPIが生成されます。

全てのエンドポイントで、**POST**メソッドを使用します。

### `/cli/run/${alias}/json`

Pythonで返却した**DataFrame**をJSON形式で取得できます。レスポンスは以下のような形式です。

```json theme={"dark"}
{
  "data": {
    {
      "count": 2,
      "items": [
        {
          "name": "Alice",
          "age": 30
        },
        {
          "name": "Bob",
          "age": 40
        }
      ]
    }
  }
}
```

### `/cli/run/${alias}/html`

Pythonで返却した**HTML文字列**をHTML形式で取得できます。レスポンスは以下のような形式です。

```json theme={"dark"}
{
  "data": "<div>...</div>"
}
```

### `/cli/run/${alias}`

Python関数を直接実行できます。
