UIで適用されたインテリジェンスの宛先を管理することに加えて、NerdGraphAPIを使用できます。
ヒント
NerdGraphの使用を開始するためのヘルプについては、NerdGraphの概要を参照してください。
宛先のリストとフィルター
destinations
クエリを使用すると、アカウントごとにすべての宛先をページ分割できます。また、いくつかのフィルタリング機能を許可します。
次の例を見てみましょう。
account(id: YOUR_ACCOUNT_ID) {
宛先をページ分割するには、最初のクエリでnextCursor
フィールドをリクエストする必要があります。
カーソルページネーションを使用すると、応答から返されるnextCursor
が空に戻るまで、結果セットを介して要求を続けます。これは、結果の最後に到達したことを意味します。
次の例を見てみましょう。
account(id: YOUR_ACCOUNT_ID) {
destinations(cursor: "") {
上のコードは、次のような結果のセットを返します。
"nextCursor": "/8o0y2qiR54m6thkdgHgwg==:jZTXDFKbTkhKwvMx+CtsPVM=",
"id": "01c0cbe7-3d70-47c1-99e0-adf906eed6c2",
"name": "Destination Name"
"id": "05db0207-c137-4985-8cb5-f21e7e57b8cc",
"name": "Another Destination Name"
// ... more destinations here in reality
そのため、その後のリクエストでは、カーソルが空になるまで、このようにカーソルを提供します。
account(id: YOUR_ACCOUNT_ID) {
destinations(cursor: "") {
APIは、名前による宛先クエリを許可します。name
フィルターは、完全一致と部分一致を返します。大文字と小文字は区別されません。これにより、指定された名前に一致する宛先の情報のみが返されます。
この例では、名前に「DevOps」が含まれる宛先を検索します。
account(id: YOUR_ACCOUNT_ID) {
APIを使用すると、宛先IDでクエリを実行できます。
account(id: YOUR_ACCOUNT_ID) {
destinations(filters: {id: YOUR_DESTINATION_ID}) {
APIを使用すると、宛先タイプでクエリを実行できます。次のクエリは、選択したアカウントのすべての電子メールの宛先を返します。
account(id: YOUR_ACCOUNT_ID) {
destinations(filters: {type: EMAIL}) {
目的地を作成する
宛先を作成するには、宛先タイプごとに異なる入力を指定する必要があります。オプションのtwo_way_integration
プロパティは、双方向の統合を可能にする統合に使用できます。
aiNotificationsCreateDestination(accountId: YOUR_ACCOUNT_ID, destination: {
name: "Destination Name",
"password": YOUR_PASSWORD
value: "https://YOUR_INSTANCE.atlassian.net"
key: "two_way_integration",
aiNotificationsCreateDestination(accountId: YOUR_ACCOUNT_ID, destination: {
name: "Destination Name",
"password": YOUR_PASSWORD
value: "https://YOUR_INSTANCE.service-now.com"
key: "two_way_integration",
slackとの統合はOAuth2認証でのみ利用可能であるため、変更を使用して宛先を作成することはできません。
この例では、統合されるサービスに応じて、 auth
はオプションです。
aiNotificationsCreateDestination(accountId: YOUR_ACCOUNT_ID, destination: {
name: "Destination Name",
"password": YOUR_PASSWORD
key: "two_way_integration",
aiNotificationsCreateDestination(accountId: YOUR_ACCOUNT_ID, destination: {
name: "Destination Name",
aiNotificationsCreateDestination(accountId: YOUR_ACCOUNT_ID, destination: {
name: "Destination Name",
"password": YOUR_PASSWORD
value: YOUR_AWS_ACCOUNT_ID
PagerDutyには、サービスレベルとアカウントレベルの2種類の統合があります。詳細については、 PagerDutyIntegrationDocsを参照してください。
サービスレベル:
aiNotificationsCreateDestination(accountId: YOUR_ACCOUNT_ID, destination: {
type: PAGERDUTY_SERVICE_INTEGRATION,
name: "Destination Name",
token: YOUR_INTEGRATION_TOKEN,
アカウントレベル:
aiNotificationsCreateDestination(accountId: YOUR_ACCOUNT_ID, destination: {
type: PAGERDUTY_ACCOUNT_INTEGRATION,
name: "Destination Name",
key: "two_way_integration",
宛先を更新する
宛先を更新するときは、宛先のすべての属性を指定する必要はないことに注意してください。たとえば、名前を更新するだけの場合は、名前を指定するだけで済みます。
aiNotificationsUpdateDestination(accountId: YOUR_ACCOUNT_ID, destinationId: YOUR_destination_ID, destination: {
name: "Updated destination Name"
目的地のテスト
NerdGraphAPIを介して宛先をテストできます。これは、宛先を作成する前または後に実行できます。
aiNotificationsTestDestination(accountId: YOUR_ACCOUNT_ID, destination: {
name: "Destination Name",
aiNotificationsTestDestinationById(accountId: YOUR_ACCOUNT_ID, destinationId: YOUR_DESTINATION_ID) {
宛先を削除する
NerdGraphAPIを介して宛先を削除できます。
aiNotificationsDeleteDestination(accountId: YOUR_ACCOUNT_ID, destinationId: YOUR_DESTINATION_ID) {