API 認証
認証されたすべての API エンドポイントにも承認が必要です。これは、指定された資格情報 (APIキー や OAuth トークンなど) に必要な API スコープが少なくとも 1 つあるかどうかを確認することによって行われます。必要に応じて、APIキー にスコープを割り当てることができます。
API スコープ
スコープは、API 環境の標準的な用語になっています。これは OAuth2 (opens in a new tab) 仕様に由来し、すべての認証タイプに同じ考え方が適用されます。これは、エンドポイント ユーザー、APIキー、または OAuth クライアントが呼び出すことができるものを制限する、REST API API に対する制御とセキュリティの追加レイヤーです。
スコープは、通常、特定のユース ケースに対応するように設計された、特定の API エンドポイントのセットへのアクセスを提供します。OAuth2 を使用して、アプリケーションがユーザーに代わって実行できる特定のアクションを定義します。
特定のAPIスコープをユーザーまたはAPIキーに付与することで、そのスコープでカバーされるAPIエンドポイントのサブセットへのアクセスを制限します。このようにして、ユーザーが自分の役割以外のデータや API 機能にアクセスできないようにすることができます。漏洩または盗難に遭った API キーまたはユーザー認証情報による潜在的な悪影響を制限できます。同じユーザーまたは APIキーに複数のスコープを付与して、複雑なユースケースに必要な複数の異なる API エンドポイントをカバーできます。
API スコープの種類
スコープの種類は、領域やコンテキストに応じてさまざまです。主なスコープは次のとおりです。
-
全般:
- メッセージ:送信
- チャネルに関係なく、モバイル終端(MT)メッセージの送信を有効にします
- すべての
channel:message:send
エンドポイント(すべてのチャネル)が含まれます
- 受信メッセージ:読み取り
- チャネルに関係なく、モバイル発信(MO)メッセージの取得を有効にします
- すべての
channel:inbound-message:read
エンドポイント(すべてのチャネル)が含まれます
- web:sdk (英語)
- クライアント側の SDK からアクセスされるエンドポイントAPI PeopleイベントとPeopleイベントへのアクセスを提供します
- モバイルアプリメッセージング:SDK
- クライアント側の SDK からアクセスされるモバイルアプリメッセージングモバイルプッシュ通知 API エンドポイントへのアクセスを提供します。
- メッセージ:送信
-
製品/チャネル:管理
- 特定の製品またはチャネルに関連するすべてのエンドポイントが含まれます。たとえば、Conversations製品の場合、Conversationsに関連するすべてのエンドポイントが含まれます。SMS チャネルの場合は、SMS に関連するすべてのエンドポイントが含まれます
さらに、チャネル、製品、およびさまざまなユースケースによって異なる他のスコープタイプがあります。使用可能なすべてのスコープは、[ APIキー の作成 (opens in a new tab) ] ページで確認できます。
API スコープの構成
API スコープを構成するには、使用する各 API エンドポイントへのアクセスを APIキー に許可する必要があります。これを行うには、まず API エンドポイントのドキュメントを確認します。必要なスコープが一覧表示されます。これらのいずれかを付与すると、APIキー がエンドポイントにアクセスできるようになります。
既存の APIキー を編集して新しいスコープを付与するか、最初からスコープを使用して新しいスコープを作成できます。
API キーは、 専用 API (opens in a new tab) または Web インターフェイスを使用して管理できます。
Web インターフェイスを使用してAPIスコープを構成する場合は、[開発者ツール] → [API キー] → [APIキーの作成 (opens in a new tab)] に移動します。
そこから、APIキー に関する次の情報を入力します。
- 名前
- 作成日
- 有効期限
- 許可された IP アドレス (オプション)
次のセクション「APIスコープ」で、含めるスコープを選択します。
- 全般
- チャンネル
- 接続
- プラットホーム
- 顧客エンゲージメント
- Web SDK
特定のスコープオプションを選択すると、使用可能なすべてのスコープを含むドロップダウンメニューが表示されます。そこから、APIキーに含めるスコープを選択する必要があります。
使用可能な API スコープ
次の表は、API プラットフォームで現在使用されているスコープの概要を示しています。
ユーザー ロールと API スコープ
APIキー を使用して Infobip HTTP API にアクセスすることをお勧めします。API スコープを詳細に制御し、他の多くのセキュリティも提供します 顔立ち。詳細については、こちらを参照してください。
APIキーを使用できず、基本認証に依存する必要がある場合は、呼び出しに使用しているパスワードのユーザーが API エンドポイントには、それらのエンドポイントにアクセスするために必要なスコープが付与されています。API キーとは異なり、スコープはユーザーに直接割り当てられません。 代わりに、ユーザーにロールを割り当てることができ、それらのロールは特定のスコープを暗黙的に付与します。
特定のロールによって暗黙的に付与されるスコープについては、以下のリストを参照してください。
Role | Scopes |
---|---|
Communication Manager | 2fa:pin:manage, calls:media:manage, viber-bm:manage, campaign-tags:manage, rcs:manage, callrouting:manage, omni-failover:logs:read, zalo:manage, number-lookup:logs:read, voice-message:logs:read, ivr:manage, mobile-app-messaging:manage, numbermasking:manage, forms:read, google-bm:manage, instagram:logs:read, email:logs:read, sms:manage, kakao:logs:read, messages-api:manage, signals:manage, forms:manage, viber-bot:manage, 2fa:manage, calls:manage, mms:manage, calls:recording:delete, webrtc:manage, forms:use, omni-failover:manage, rcs:logs:read, messenger:logs:read, inbound-message:read, viber-bot:logs:read, calls:traffic:record, flow:manage, campaign-tags:view, kakao:manage, google-bm:logs:read, calls:recording:read, web-push:manage, clicktocall:manage, number-activation-state:read, calllink:link:manage, calllink:configuration:manage, blocklist:manage, numbers:manage, apple-mfb:logs:read, voice:recording:delete, viber-bm:logs:read, whatsapp:manage, whatsapp:logs:read, voice:recording:read, message:send, voice-reports:read, flow:read, voice-message:manage, people:manage, conversations:manage, instagram:manage, live-chat:manage, mms:logs:read, metrics:manage, calls:configuration:manage, email:manage, zalo-follower:manage, calls:bulk:manage, rbm-maap:manage, voice:logs:read, number-lookup:manage, numbers:recording:manage, calls:logs:read, line:manage, content-messages:read, catalogs:manage, sending-strategy:manage, sms:logs:read, zalo:logs:read, answers:manage, calllink:manage, apple-mfb:manage, people:read, ivr:configuration:manage, voice:recording:manage, messenger:manage |
People Manager | people:manage, conversations:manage, people:read, account-management:manage, forms:manage, mobile-app-messaging:manage, blocklist:manage |
Analyze Manager | calls:media:manage, google-bm:logs:read, calls:recording:read, account-management:manage, omni-failover:logs:read, number-lookup:logs:read, whatsapp:inbound-message:read, voice-message:logs:read, mms:inbound-message:read, numbermasking:manage, instagram:logs:read, email:logs:read, apple-mfb:logs:read, kakao:logs:read, voice:recording:delete, viber-bm:logs:read, whatsapp:logs:read, voice:recording:read, voice-reports:read, flow:read, calls:recording:delete, forms:use, people:manage, conversations:manage, rcs:logs:read, mms:logs:read, messenger:logs:read, metrics:manage, calls:read, inbound-message:read, sms:inbound-message:read, voice:logs:read, numbers:recording:manage, viber-bot:logs:read, calls:logs:read, calls:traffic:record, answers:manage, sms:logs:read, zalo:logs:read, people:read, voice:recording:manage |
Finance Data Manager | forms:use, numbers:manage, conversations:manage, account-management:manage |
Account Manager | viber-bm:manage, campaign-tags:manage, rcs:manage, number-lookup:send, zalo:manage, number-lookup:logs:read, whatsapp:inbound-message:read, resource-request-hub:read, voice-message:logs:read, ivr:manage, mobile-app-messaging:manage, resource-request-hub:manage, sms:message:send, forms:read, instagram:logs:read, email:logs:read, sms:manage, kakao:logs:read, messages-api:manage, answers:testing, tiktok:manage, viber-bot:manage, flow:use, calls:manage, saas:tiktok-ads:manage, onboarding:manage, forms:use, rbm-maap:message:send, catalogs:use, omni-failover:message:send, messenger:logs:read, calls:traffic:receive, viber-bm:message:send, inbound-message:read, voice-message:message:send, viber-bot:logs:read, 2fa:pin:send, line:message:send, calls:traffic:record, google-bm:message:send, flow:manage, tiktok:message:send, subscriptions:manage, google-bm:logs:read, mobile-app-messaging:send, calls:recording:read, account-management:manage, web-push:manage, clicktocall:manage, blocklist:manage, apple-mfb:logs:read, whatsapp:manage, whatsapp:logs:read, email:templates:manage, people:manage, conversations:manage, 2fa:sdk, metrics:manage, calls:traffic:send, calls:configuration:manage, zalo-follower:manage, voice:logs:read, number-lookup:manage, numbers:recording:manage, kakao:message:send, saas:integrations:manage, email:message:send, zalo-follower:logs:read, line:manage, catalogs:manage, catalogs:read, audit-logs:read, mobile-app-messaging:inbound-message:read, sending-strategy:manage, apple-mfb:message:send, sms:logs:read, answers:manage, calllink:manage, apple-mfb:manage, whatsapp:message:send, ivr:configuration:manage, voice:recording:manage, 2fa:pin:manage, calls:media:manage, callrouting:manage, omni-failover:logs:read, webrtc:identity:manage, tiktok:logs:read, mobile-app-messaging:logs:read, mms:message:send, numbermasking:manage, google-bm:manage, viber-bot:message:send, signals:manage, people:use, forms:manage, mobile-identity:manage, 2fa:manage, mms:manage, calls:recording:delete, webrtc:manage, webrtc:media:manage, omni-failover:manage, rcs:logs:read, calls:read, sms:inbound-message:read, messages-api:message:send, ivr:message:send, whatsapp:conversions, web-push:send, messenger:message:send, campaign-tags:view, kakao:manage, number-activation-state:read, calllink:link:manage, calllink:configuration:manage, mms:inbound-message:read, numbers:manage, ai:read, application-entity:manage, voice:recording:delete, viber-bm:logs:read, voice:recording:read, zalo:message:send, message:send, webrtc:configuration:manage, voice-reports:read, flow:read, content-messages:manage, voice-message:manage, zalo-follower:message:send, instagram:manage, live-chat:manage, mms:logs:read, email:manage, calls:bulk:manage, rbm-maap:manage, instagram:message:send, calls:logs:read, content-messages:read, zalo:logs:read, people:read, web:sdk, rcs:message:send, messenger:manage, error-codes:read, biometrics:manage |
Integrations Manager | viber-bm:manage, campaign-tags:manage, rcs:manage, number-lookup:send, zalo:manage, number-lookup:logs:read, whatsapp:inbound-message:read, resource-request-hub:read, voice-message:logs:read, ivr:manage, mobile-app-messaging:manage, resource-request-hub:manage, sms:message:send, forms:read, instagram:logs:read, email:logs:read, sms:manage, kakao:logs:read, messages-api:manage, answers:testing, tiktok:manage, viber-bot:manage, flow:use, calls:manage, saas:tiktok-ads:manage, onboarding:manage, forms:use, rbm-maap:message:send, catalogs:use, omni-failover:message:send, messenger:logs:read, calls:traffic:receive, viber-bm:message:send, inbound-message:read, voice-message:message:send, viber-bot:logs:read, 2fa:pin:send, line:message:send, calls:traffic:record, google-bm:message:send, flow:manage, tiktok:message:send, subscriptions:manage, google-bm:logs:read, mobile-app-messaging:send, calls:recording:read, account-management:manage, web-push:manage, clicktocall:manage, blocklist:manage, apple-mfb:logs:read, whatsapp:manage, whatsapp:logs:read, email:templates:manage, people:manage, conversations:manage, 2fa:sdk, metrics:manage, calls:traffic:send, calls:configuration:manage, zalo-follower:manage, voice:logs:read, number-lookup:manage, numbers:recording:manage, kakao:message:send, saas:integrations:manage, email:message:send, zalo-follower:logs:read, line:manage, catalogs:manage, catalogs:read, audit-logs:read, mobile-app-messaging:inbound-message:read, sending-strategy:manage, apple-mfb:message:send, sms:logs:read, answers:manage, calllink:manage, apple-mfb:manage, whatsapp:message:send, ivr:configuration:manage, voice:recording:manage, 2fa:pin:manage, calls:media:manage, callrouting:manage, omni-failover:logs:read, webrtc:identity:manage, tiktok:logs:read, mobile-app-messaging:logs:read, mms:message:send, numbermasking:manage, google-bm:manage, viber-bot:message:send, signals:manage, people:use, forms:manage, mobile-identity:manage, 2fa:manage, mms:manage, calls:recording:delete, webrtc:manage, webrtc:media:manage, omni-failover:manage, rcs:logs:read, calls:read, sms:inbound-message:read, messages-api:message:send, ivr:message:send, whatsapp:conversions, web-push:send, messenger:message:send, campaign-tags:view, kakao:manage, number-activation-state:read, calllink:link:manage, calllink:configuration:manage, mms:inbound-message:read, numbers:manage, ai:read, application-entity:manage, voice:recording:delete, viber-bm:logs:read, voice:recording:read, zalo:message:send, message:send, webrtc:configuration:manage, voice-reports:read, flow:read, content-messages:manage, voice-message:manage, zalo-follower:message:send, instagram:manage, live-chat:manage, mms:logs:read, email:manage, calls:bulk:manage, rbm-maap:manage, instagram:message:send, calls:logs:read, content-messages:read, zalo:logs:read, people:read, web:sdk, rcs:message:send, messenger:manage, error-codes:read, biometrics:manage |
Conversations Agent | conversations:manage, content-messages:read, calls:manage, forms:manage |
Conversations Manager | conversations:manage, content-messages:read, catalogs:manage, calls:manage, forms:manage, content-messages:manage |
Conversations Analyze Manager | conversations:manage |
Conversations Account Manager | conversations:manage, account-management:manage |
Answers Manager | google-bm:logs:read, rcs:logs:read, live-chat:manage, mms:logs:read, messenger:logs:read, omni-failover:logs:read, number-lookup:logs:read, voice:logs:read, viber-bot:logs:read, voice-message:logs:read, instagram:logs:read, calls:logs:read, email:logs:read, catalogs:manage, apple-mfb:logs:read, kakao:logs:read, viber-bm:logs:read, whatsapp:logs:read, answers:manage, sms:logs:read, zalo:logs:read |
Answers Designer | instagram:logs:read, calls:logs:read, email:logs:read, google-bm:logs:read, rcs:logs:read, catalogs:manage, apple-mfb:logs:read, kakao:logs:read, mms:logs:read, viber-bm:logs:read, whatsapp:logs:read, messenger:logs:read, zalo:logs:read, answers:manage, sms:logs:read, omni-failover:logs:read, number-lookup:logs:read, voice:logs:read, viber-bot:logs:read, voice-message:logs:read |
Answers Supervisor | answers:manage |
Knowledge Base Manager | conversations:manage |
Knowledge Base User | conversations:manage |
Campaign Content Creator | instagram:logs:read, calls:logs:read, email:logs:read, google-bm:logs:read, rcs:logs:read, apple-mfb:logs:read, kakao:logs:read, mms:logs:read, viber-bm:logs:read, whatsapp:logs:read, messenger:logs:read, zalo:logs:read, sms:logs:read, omni-failover:logs:read, number-lookup:logs:read, voice:logs:read, viber-bot:logs:read, voice-message:logs:read |
Campaign Approval Manager | instagram:logs:read, calls:logs:read, email:logs:read, google-bm:logs:read, rcs:logs:read, apple-mfb:logs:read, kakao:logs:read, mms:logs:read, viber-bm:logs:read, whatsapp:logs:read, messenger:logs:read, zalo:logs:read, sms:logs:read, omni-failover:logs:read, number-lookup:logs:read, voice:logs:read, viber-bot:logs:read, voice-message:logs:read |
Content Manager | campaign-tags:view, conversations:manage, content-messages:read, content-messages:manage |
エラー
指定されたユーザーまたは APIキーに必要なスコープがない場合、応答で 403 Forbidden
HTTP ステータス コードを受け取ります。
{
"requestError": {
"serviceException": {
"messageId": "FORBIDDEN",
"text": "Forbidden"
}
}
}
ライブラリの例外
ライブラリ (opens in a new tab)のいずれかを使用する場合は、必ずAPI例外を処理してください。
try {
SmsResponse smsResponse = sendSmsApi.sendSmsMessage(smsMessageRequest);
} catch (ApiException apiException) {
apiException.getCode();
apiException.getResponseHeaders();
apiException.getResponseBody();
}
try
{
var result = api.SendSmsMessage(smsRequest);
}
catch(ApiException apiException)
{
var errorCode = apiException.ErrorCode;
var errorContent = apiException.ErrorContent;
}