# APIの認証情報を設定する

Dashcombがサポートしている[UI Component](https://docs.dashcomb.com/dashcomb-help-center/ide/ui-component)とREST APIを利用して、認証情報を設定することができます。

## 準備

* このAPIの連携先になる管理画面を作成しておきます。

## 実現

* [REST APIへの接続設定](https://docs.dashcomb.com/dashcomb-help-center/ide/others/dtassu/api#rest-apiへの接続設定-rest-api)画面でAPI設定します。
* 「エンドポイント」に `https://httpbin.org` を入力します。
* 「保存」ボタンを押すと、API接続の作成ができました。
* Bearerトークン認証用に管理画面へ[Textarea](https://docs.dashcomb.com/dashcomb-help-center/ide/ui-component/textarea)をドラッグ＆ドロップします。
  * 例えば、オブジェクト名は `textarea1` とします。
* 管理画面の[クエリ領域](https://docs.dashcomb.com/dashcomb-help-center/ide/query-region)で「API」タブをクリックします。
* 「+」アイコンを押して、API名を作成します。
* データソースリストから先ほど作成したREST APIを選びます。
* 「実行前アクション」に「アクション無し」、「確認」、「承認」を選べることができます。
  * ここでは初期の「アクション無し」を選びます。
* 続いては「POST」を選びます。
* 「パラメーター」に `authorization` を入力します。
* 右の入力ボックスに `{{textarea1.value}}` を入力します。
* 「成功時」、「失敗時」の「アクション」や「通知」を設定します。
  * 設定方法の詳細は[アクションエディタ](https://docs.dashcomb.com/dashcomb-help-center/ide/property-region/action-editor)にご参考ください。
  * ここでは全て初期の「アクション無し」を選びます。
* 「保存」ボタンを押すと、APIの認証情報の設定ができました。

## 参照項目

* [API接続](https://docs.dashcomb.com/dashcomb-help-center/ide/others/dtassu/api)
* [API経由のCRUD操作](https://docs.dashcomb.com/dashcomb-help-center/tips-and-tricks/api-crud)
* [Textareaの使い方](https://docs.dashcomb.com/dashcomb-help-center/ide/ui-component/textarea)
* [アクションエディタ](https://docs.dashcomb.com/dashcomb-help-center/ide/property-region/action-editor)
