ניהול התראות והודעות באמצעות ממשק ה-API

כרגע מוצג התיעוד של Apigee Edge.
כניסה למסמכי התיעוד של Apigee X.
מידע

בקטעים הבאים מוסבר איך לנהל את ההתראות באמצעות ה-API.

למידע נוסף על ממשק ה-API של התראות, ראה Alerts API.

הגדרת התראות והודעות באמצעות ה-API

אפשר להגדיר התראות והודעות על ידי שליחת בקשת POST למשאב הבא: https://apimonitoring.enterprise.apigee.com/alerts.

בקטעים הבאים מוצגות דוגמאות להגדרת התראות והודעות באמצעות ה-API:

הגדרת התראה לגבי קוד סטטוס 5xx לשרת proxy של API באמצעות ה-API

הדוגמה הבאה מראה איך להגדיר התראה שמופעלת כשקודי סטטוס 5xx מתרחשים בקצב של יותר מ-100 עסקאות לשנייה (TPS) למשך 10 דקות עבור שרת proxy ל-Hotel API בסביבת הייצור של אזור כלשהו. כשההתראה מופעלת, נשלחת הודעה לכתובת האימייל שצוינה.

curl 'https://apimonitoring.enterprise.apigee.com/alerts' \
  -X POST \
  -H 'Accept: application/json, text/plain, */*' -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
     "organization":"myorg",
     "name":"5xx Alert",
     "description":"My 5xx alert",
     "environment":"prod",
     "enabled":true,
     "conditions":[
     {
        "description":"",
        "dimensions":{
            "org":"myorg", 
            "env":"prod", 
            "proxy":"hotels",
            "region":"ANY",
            "statusCode":"5xx"
        },
        "metric":"tps",
        "threshold":100,
        "durationSeconds":600,
        "comparator":">"
     }
     ],
     "notifications":[{ 
         "channel":"email", 
         "destination":"ops@acme.com"
     }],
     "playbook":"http://acme.com/myplaybook.html",
     "throttleIntervalSeconds":3600,
     "reportEnabled":true
    }'

מגדירים את $ACCESS_TOKEN לאסימון הגישה מסוג OAuth 2.0, כמו שמתואר במאמר קבלת אסימון גישה מסוג OAuth 2.0.

למידע על אפשרויות cURL המשמשות בדוגמה זו, ראה שימוש ב-cURL.

הגדרת התראה לגבי זמן אחזור באחוזון ה-95 לשרת proxy ל-API באמצעות ה-API

הדוגמה הבאה מראה איך להגדיר התראה שמופעלת אם זמן האחזור הכולל לתגובה במאון ה-95 גדול מ-100 אלפיות השנייה למשך 5 דקות לגבי שרת proxy ל-Hotel API בסביבת הייצור של אזור כלשהו.

במקרה שבו מופעלת ההתראה, נשלחת התראה ל-webhook שצוין.

curl 'https://apimonitoring.enterprise.apigee.com/alerts' \
  -X POST \
  -H 'Accept: application/json, text/plain, */*' -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
     "organization":"myorg",
     "name":"My Alert",
     "description":"My first alert",
     "environment":"prod",
     "enabled":true,
     "conditions":[
     {
        "description":"",
        "dimensions":{
            "org":"myorg", 
            "env":"prod",
            "proxy" : "hotels",
            "region":"ANY",
            "percentile":"95"
        },
        "metric":"totalLatency",
        "threshold":100,
        "durationSeconds":300,
        "comparator":">"
     }
     ],
     "notifications":[{ "channel":"webhook", "destination":"https://apigee.com/test-webhook"}],
     "playbook":"http://acme.com/myplaybook.html",
     "throttleIntervalSeconds":3600,
     "reportEnabled":true
}'

מגדירים את $ACCESS_TOKEN לאסימון הגישה מסוג OAuth 2.0, כמו שמתואר במאמר קבלת אסימון גישה מסוג OAuth 2.0.

למידע על אפשרויות cURL המשמשות בדוגמה זו, ראה שימוש ב-cURL.

הגדרת התראת קוד סטטוס 404 (היישום לא נמצא) לכל שרתי ה-proxy של ממשק ה-API שמשתמשים ב-API

הדוגמה הבאה מראה איך להגדיר התראה שמופעלת כשמופיעים קודי סטטוס של HTTP 404 בקצב שגבוה מ-10% למשך 5 דקות לכל שרתי ה-proxy של ה-API בסביבת הייצור של כל אזור.

כשההתראה מופעלת, נשלחת התראה לערוץ Slack שצוין.

curl 'https://apimonitoring.enterprise.apigee.com/alerts' \
  -X POST \
  -H 'Accept: application/json, text/plain, */*' -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
     "organization":"myorg",
     "name":"404 Application Not Found Alert",
     "description":"My 404 alert",
     "environment":"prod",
     "enabled":true,
     "conditions":[
     {
        "description":"",
        "dimensions":{"org":"myorg", 
            "env":"prod", 
            "proxy":"ALL",
            "region":"ANY",
            "statusCode":"404"},
        "metric":"rate",
        "threshold":0.05,
        "durationSeconds":300,
        "comparator":">"
     }],
     "notifications":[{ "channel":"slack", "destination":"https://hooks.slack.com/services/T00000000/B00000000/XXXXX"}],
     "playbook":"http://acme.com/myplaybook.html",
     "throttleIntervalSeconds":3600,
     "reportEnabled":true
}'

מגדירים את $ACCESS_TOKEN לאסימון הגישה מסוג OAuth 2.0, כמו שמתואר במאמר קבלת אסימון גישה מסוג OAuth 2.0.

למידע על אפשרויות cURL המשמשות בדוגמה זו, ראה שימוש ב-cURL.

הגדרה של התראת ספירה של שרת proxy ל-API עבור ממשקי API באמצעות ה-API

הדוגמה הבאה מראה איך להגדיר התראה שמופעלת כשמספר הקודים 5xx לממשקי API חורג מ-200 למשך 5 דקות באזור כלשהו.

בדוגמה הזו, ממשקי ה-API מתועדים באוסף 'שרתי proxy ל-API' (עם UUID aeff4394-86b7-11e8-83d7-42010a840040). כדי לקבל את ה-UUID של קולקציה, אפשר לעיין במאמר הצגת כל האוספים שמשתמשים ב-API.

curl 'https://apimonitoring.enterprise.apigee.com/alerts' \
  -X POST \
  -H 'Accept: application/json, text/plain, */*' -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
     "organization":"myorg",
     "name":"Proxy Count Alert",
     "description":"My proxy count alert",
     "environment":"prod",
     "enabled":true,
     "conditions":[
     {
        "description":"",
        "dimensions":{
            "collection":"aeff4394-86b7-11e8-83d7-42010a840040",
            "org":"myorg", 
            "env":"prod",
            "proxy" : "ANY",
            "region":"ANY",
            "statusCode":"5xx"
        },
        "metric":"count",
        "threshold":200,
        "durationSeconds":300,
        "comparator":">"
     }
     ],
     "notifications":[{ 
         "channel":"email", 
         "destination":"ops@acme.com"
     }],
     "playbook":"http://acme.com/myplaybook.html",
     "throttleIntervalSeconds":3600,
     "reportEnabled":true
    }'

מגדירים את $ACCESS_TOKEN לאסימון הגישה מסוג OAuth 2.0, כמו שמתואר במאמר קבלת אסימון גישה מסוג OAuth 2.0.

למידע על אפשרויות cURL המשמשות בדוגמה זו, ראה שימוש ב-cURL.

איך מגדירים התראה על שיעור שגיאות לשירותי יעד באמצעות ה-API

הדוגמה הבאה ממחישה איך מגדירים התראה שמופעלת כשקצב הקוד של 500 לשירותי יעד גדול מ-10% למשך שעה באזור כלשהו.

בדוגמה הזו, שירותי היעד מתועדים באוסף 'יעדים קריטיים' (עם UUID aeff4394-86b7-11e8-83d7-42010a840040). כדי לקבל את ה-UUID של קולקציה, אפשר לעיין במאמר הצגת כל האוספים שמשתמשים ב-API.

curl 'https://apimonitoring.enterprise.apigee.com/alerts' \
  -X POST \
  -H 'Accept: application/json, text/plain, */*' -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
     "organization":"myorg",
     "name":"Error rate Alert",
     "description":"My error rate alert",
     "environment":"prod",
     "enabled":true,
     "conditions":[
     {
        "description":"",
        "dimensions":{
            "collection":"aeff4394-86b7-11e8-83d7-42010a840040",
            "org":"myorg", 
            "env":"prod",
            "proxy" : "ANY",
            "region":"ANY",
            "statusCode":"500"
        },
        "metric":"rate",
        "threshold":0.1,
        "durationSeconds":3600,
        "comparator":">"
     }
     ],
     "notifications":[{ 
         "channel":"email", 
         "destination":"ops@acme.com"
     }],
     "playbook":"http://acme.com/myplaybook.html",
     "throttleIntervalSeconds":3600,
     "reportEnabled":true
    }'

מגדירים את $ACCESS_TOKEN לאסימון הגישה מסוג OAuth 2.0, כמו שמתואר במאמר קבלת אסימון גישה מסוג OAuth 2.0.

למידע על אפשרויות cURL המשמשות בדוגמה זו, ראה שימוש ב-cURL.

הגדרת התראה על שיעור שגיאות במדיניות בנושא יתרונות מרכזיים של שירות באמצעות ה-API

הדוגמה הבאה ממחישה איך מגדירים התראה שמופעלת כששיעור הקוד 500 של השירות שמצוין במדיניות של 'יתרונות מרכזיים' גדול מ-10% למשך שעה בכל אזור.

curl 'https://apimonitoring.enterprise.apigee.com/alerts' \
  -X POST \
  -H 'Accept: application/json, text/plain, */*' -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
     "organization":"myorg",
     "name":"Error rate Alert",
     "description":"My error rate alert",
     "environment":"prod",
     "enabled":true,
     "conditions":[
     {
        "description":"",
        "dimensions":{
            "target": "sc://docstore-api",
            "org":"myorg", 
            "env":"prod",
            "proxy" : "ANY",
            "region":"ANY",
            "statusCode":"500"
        },
        "metric":"rate",
        "threshold":0.1,
        "durationSeconds":3600,
        "comparator":">"
     }
     ],
     "notifications":[{ 
         "channel":"email", 
         "destination":"ops@acme.com"
     }],
     "playbook":"http://acme.com/myplaybook.html",
     "throttleIntervalSeconds":3600,
     "reportEnabled":true
    }'

מגדירים את $ACCESS_TOKEN לאסימון הגישה מסוג OAuth 2.0, כמו שמתואר במאמר קבלת אסימון גישה מסוג OAuth 2.0.

למידע על אפשרויות cURL המשמשות בדוגמה זו, ראה שימוש ב-cURL.

הגדרת התראה לגבי קוד שגיאה של מדיניות באמצעות ה-API

הדוגמה הבאה מראה איך להגדיר התראה שמופעלת אם מתקיים אחד מהתנאים הבאים:

  • מספר קודי השגיאה של SpikeArrestViolation גדול מ-10 למשך 5 דקות לממשקי API בסביבת הייצור לכל אזור.
  • הספירה של כל קודי השגיאות של פרוטוקול ה-API גדולה מ-3% למשך 5 דקות בממשקי ה-API בסביבת הייצור לכל אזור.

בדוגמה הזו, ממשקי ה-API מתועדים באוסף 'שרתי proxy ל-API' (עם UUID aeff4394-86b7-11e8-83d7-42010a840040). כדי לקבל את ה-UUID של קולקציה, אפשר לעיין במאמר הצגת כל האוספים שמשתמשים ב-API.

כשההתראה מופעלת, נשלחת התראה לקוד של PagerDuty שצוין.

curl 'https://apimonitoring.enterprise.apigee.com/alerts' \
  -X POST \
  -H 'Accept: application/json, text/plain, */*' -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
     "organization":"myorg",
     "name":"My Fault Code Alert",
     "description":"My fault code alert",
     "environment":"prod",
     "enabled":true,
     "conditions":[
     {
        "description":"",
        "dimensions": { 
            "collection":"aeff4394-86b7-11e8-83d7-42010a840040",
            "org":"myorg",
            "env":"prod",
            "proxy":"ANY",
            "region":"ANY",
            "faultCodeCategory":"Traffic Mgmt Policy",
            "faultCodeSubCategory":"Spike Arrest",
            "faultCodeName":"SpikeArrest Violation"
        },
        "metric":"count,
        "threshold":10,
        "durationSeconds":300,
        "comparator":">"
     },
     {
       "description":"",
       "dimensions": { 
           "collection":"aeff4394-86b7-11e8-83d7-42010a840040",
           "org":"myorg",
           "env":"prod",
           "proxy":"ANY",
           "region":"ANY",
           "faultCodeCategory":"API Protocol",
           "faultCodeSubCategory":"ALL"
       },
       "metric":"rate",
       "threshold":0.03,
       "durationSeconds":300,
       "comparator":">"
     }   
     ],
     "notifications":[{ "channel":"pagerduty", "destination":"abcd1234efgh56789"}],
     "playbook":"http://acme.com/myplaybook.html",
     "throttleIntervalSeconds":3600,
     "reportEnabled":true
}'

מגדירים את $ACCESS_TOKEN לאסימון הגישה מסוג OAuth 2.0, כמו שמתואר במאמר קבלת אסימון גישה מסוג OAuth 2.0.

למידע על אפשרויות cURL המשמשות בדוגמה זו, ראה שימוש ב-cURL.

הצגת התראות והודעות

בקטעים הבאים תוכלו לראות דוגמאות להצגת הגדרות של התראות ומידע על התראות שמופעלות באמצעות ה-API:

הצגת כל הגדרות ההתראות של ארגון

כדי להציג את כל ההגדרות של ההתראות וההתראות, צריך לשלוח בקשת GET לממשק ה-API הבא: https://apimonitoring.enterprise.apigee.com/alerts.

צריך להעביר את שם הארגון באמצעות פרמטר השאילתה org.

לדוגמה:

curl 'https://apimonitoring.enterprise.apigee.com/alerts?org=myorg'
    -X GET
    -H 'Accept: application/json, text/plain, */*'
    -H "Authorization: Bearer $ACCESS_TOKEN"    

ה-UUID של ההתראה מוצג בשדה uuid של התשובה. צריך את ה-UUID הזה כדי לבצע קריאות כדי לקבל מידע ספציפי לגבי הגדרת התראה. לפניכם דוגמה לתשובה:

[ 
 {
    "uuid": "4fa49a87-3463023ea7c4",
    "name": "PublicAPI latency alert",
    "enabled": true,
    "description": "Public API Latency alerts, 90th %ile > 6secs for 5 minute window trigger this alert",
    "conditions": [
      {
        "uuid": "4fa49a87-3463023ea7c4",
        "description": "",
        "dimensions": {
          "env": "prod",
          "org": "myorg",
          "percentile": "90",
          "proxy": "PublicAPI",
          "region": "ANY"
        },
        "metric": "totalLatency",
        "threshold": 6000,
        "durationSeconds": 300,
        "comparator": ">",
        "updatedBy": "me@foo.com"
      }
    ],
    "playbook": "PublicAPI Latency alert, setup to go off when 90th %ile is > 4 secs for 5 minute window",
    "throttleIntervalSeconds": 3600,
    "self": "/alerts/4fa49a87-3463023ea7c4",
    "feed": "/o/myorg/events/4fa49a87-3463023ea7c4",
    "organization": "myorg",
    "environment": "prod",
    "notifications": [
      {
        "channel": "email",
        "destination": "me@foo.com"
      }
    ],
    "updatedAt": "2018-07-19T18:19:31.654738Z",
    "updatedBy": "me@foo.com"
  },
  {
    "uuid": "ef1a5249-345ed3023ea7c4",
    "name": "Minty API Latency alert",
    "enabled": true,
    "description": "Minty API Latency alerts, 90th %ile > 6secs for 5 minute window trigger this alert",
    "conditions": [
      {
        "uuid": "ef1a5249-345ed3023ea7c4",
        "description": "",
        "dimensions": {
          "env": "prod",
          "org": "myorg",
          "percentile": "90",
          "proxy": "minty",
          "region": "ANY"
        },
        "metric": "totalLatency",
        "threshold": 6000,
        "durationSeconds": 300,
        "comparator": ">",
        "updatedBy": "me@foo.com"
      }
    ],
    "playbook": "Minty API",
    "throttleIntervalSeconds": 3600,
    "self": "/alerts/ef1a5249-345ed3023ea7c4",
    "feed": "/o/myorg/events/ef1a5249-345ed3023ea7c4",
    "organization": "myorg",
    "environment": "prod",
    "notifications": [
      {
        "channel": "email",
        "destination": "me@foo.com"
      }
    ],
    "updatedAt": "2018-07-19T18:19:33.22479Z",
    "updatedBy": "me@foo.com"
  },
 ...
]

מגדירים את $ACCESS_TOKEN לאסימון הגישה מסוג OAuth 2.0, כמו שמתואר במאמר קבלת אסימון גישה מסוג OAuth 2.0.

למידע על אפשרויות cURL המשמשות בדוגמה זו, ראה שימוש ב-cURL.

הצגת הגדרה ספציפית של התראה

כדי לצפות בהגדרה ספציפית של התראה, צריך לשלוח בקשת GET למשאב הבא: https://apimonitoring.enterprise.apigee.com/alerts/alert_uuid כאשר alert_uuid מציין את ה-UUID של הגדרת ההתראה. מקבלים את ה-UUID כשיוצרים את ההתראה או משתמשים בקריאה ל-API שמוצגת בקטע הקודם, כדי להציג את כל ההתראות ואת ה-UUID המשויך אליהן.

לדוגמה:

curl 'https://apimonitoring.enterprise.apigee.com/alerts/4fa49a87-3463023ea7c4'
    -X GET
    -H 'Accept: application/json, text/plain, */*'
    -H "Authorization: Bearer $ACCESS_TOKEN"    

למטה מוצגת דוגמה לתשובה:

  {
    "uuid": "4fa49a87-3463023ea7c4",
    "name": "PublicAPI latency alert",
    "enabled": true,
    "description": "Public API Latency alerts, 90th %ile > 6secs for 5 minute window trigger this alert",
    "conditions": [
      {
        "uuid": "4fa49a87-3463023ea7c4",
        "description": "",
        "dimensions": {
          "env": "prod",
          "org": "myorg",
          "percentile": "90",
          "proxy": "PublicAPI",
          "region": "ANY"
        },
        "metric": "totalLatency",
        "threshold": 6000,
        "durationSeconds": 300,
        "comparator": ">",
        "updatedBy": "me@foo.com"
      }
    ],
    "playbook": "PublicAPI Latency alert, setup to go off when 90th %ile is > 4 secs for 5 minute window",
    "throttleIntervalSeconds": 3600,
    "self": "/alerts/4fa49a87-3463023ea7c4",
    "feed": "/o/myorg/events/4fa49a87-3463023ea7c4",
    "organization": "myorg",
    "environment": "prod",
    "notifications": [
      {
        "channel": "email",
        "destination": "me@foo.com"
      }
    ],
    "updatedAt": "2018-07-19T18:19:31.654738Z",
    "updatedBy": "me@foo.com"
  }

מגדירים את $ACCESS_TOKEN לאסימון הגישה מסוג OAuth 2.0, כמו שמתואר במאמר קבלת אסימון גישה מסוג OAuth 2.0.

למידע על אפשרויות cURL המשמשות בדוגמה זו, ראה שימוש ב-cURL.

הצגת ההיסטוריה של כל ההתראות שהופעלו עבור ארגון

אפשר לראות את ההיסטוריה של כל ההתראות שהופעלו בארגון על ידי שליחה של בקשת GET למשאב הבא: https://apimonitoring.enterprise.apigee.com/metrics/alerthistory.

צריך להעביר את שם הארגון באמצעות פרמטר השאילתה org. ניתן לציין תקופת זמן המשמשת לחיפוש התראות מופעלות. ברירת המחדל היא הצגת כל ההתראות שהתקבלו בשעה האחרונה.

לדוגמה:

curl 'https://apimonitoring.enterprise.apigee.com/metrics/alerthistory?org=myorg'
    -X GET
    -H 'Accept: application/json, text/plain, */*'
    -H "Authorization: Bearer $ACCESS_TOKEN"    

התגובה מכילה מערך של כל ההתראות שהופעלו במהלך פרק הזמן המבוקש. בגוף התגובה, השדה id מציין את ה-UUID של ההתראה המופעלת, והשדה shared_id מציין את ה-UUID של הגדרת ההתראה שמשויכת להתראה המופעלת.

למטה מוצגת דוגמה לתשובה.

[
  {
    "id": "80cbe560-f6e0-475c6f7ed2d",
    "shared_id": "4fa49a87-3463023ea7c4",
    "organization": "myorg",
    "environment": "prod",
    "name": "PublicAPI latency alert",
    "type": "Alert",
    "source": "null/current",
    "raw_payload": "{\"reportUUID\":\"\",\"reportEnabled\":false,\"organization\":\"myorg\",\"name\":\"emgmt-api 404\",\"self\":\"/alerts/4fa49a87-3463023ea7c4\",\"description\":\"go/apigee-extensions-playbook\",\"conditions\":[
  {\"comparator\":\">\",\"metric\":\"rate\",\"durationSeconds\":300,\"name\":\"PublicAPI latency alert\",\"description\":\"\",\"threshold\":0.05,\"dimensions\":{\"proxy\":\"emgmt-api\",\"org\":\"myorg\",\"env\":\"prod\",\"region\":\"any\",\"statusCode\":\"404\"}}],\"uuid\":\"4fa49a87-3463023ea7c4\",\"playbook\":\"go/apigee-extensions-playbook\"}",
    "time": "2019-03-25T15:30:18Z"
  },
  {
    "id": "8131d740-6680-45b9c72c3",
    "shared_id": "1a64885b-f9-42010a850039",
    "organization": "apigee-pinpoint",
    "environment": "prod",
    "name": "Demo 5xx alert",
    "type": "Alert",
    "source": "null/current",
    "raw_payload": "{\"reportUUID\":\"\",\"reportEnabled\":false,\"organization\":\"myorg\",\"name\":\"Demo 5xx alert\",\"self\":\"/alerts/1a64885b-f9-42010a850039\",\"description\":\"Demo 5xx alert\",\"conditions\":[
  {\"comparator\":\">\",\"metric\":\"rate\",\"durationSeconds\":300,\"name\":\"Demo 5xx alert\",\"description\":\"\",\"threshold\":0.4,\"dimensions\":{\"proxy\":\"ALL\",\"org\":\"myorg\",\"env\":\"prod\",\"region\":\"any\",\"statusCode\":\"5xx\"}}],\"uuid\":\"1a64885b-f9-42010a850039\",\"playbook\":\"Recommended Playbook\"}",
    "time": "2019-03-25T15:57:30Z"
  },
 ...
]

מגדירים את $ACCESS_TOKEN לאסימון הגישה מסוג OAuth 2.0, כמו שמתואר במאמר קבלת אסימון גישה מסוג OAuth 2.0.

למידע על אפשרויות cURL המשמשות בדוגמה זו, ראה שימוש ב-cURL.

הצגת ההיסטוריה של התראה ספציפית

כדי להציג את ההיסטוריה של התראות שהופעלו לגבי הגדרה ספציפית של התראה, צריך לשלוח בקשת GET למשאב הבא: https://apimonitoring.enterprise.apigee.com/metrics/alerthistory.

צריך להעביר את שם הארגון באמצעות פרמטר השאילתה org וה-UUID של הגדרת ההתראה. ניתן לציין פרק זמן לחיפוש התראות. ברירת המחדל היא הצגת כל ההתראות שהופעלו בשעה האחרונה.

אתם יכולים לקבל את הגדרת ה-UUID של הגדרת ההתראה מהיסטוריית ההתראות, כפי שהוצג בקטע הקודם, כשיצרתם את הגדרת ההתראה, או באמצעות הקריאה ל-API שמופיעה להצגת כל הגדרות ההתראות.

לדוגמה:

curl 'https://apimonitoring.enterprise.apigee.com/metrics/alerthistory?org=myorg&alertId=4fa49a87-3463023ea7c4'
    -X GET
    -H 'Accept: application/json, text/plain, */*'
    -H "Authorization: Bearer $ACCESS_TOKEN"    

בתגובה יש מערך של כל ההתראות שהופעלו בפרק הזמן המבוקש עבור הגדרת UUID של הגדרת ההתראה שצוינה. בגוף התגובה, השדה id מציין את ה-UUID של ההתראה המופעלת, והשדה shared_id מציין את ה-UUID של הגדרת ההתראה שמשויכת להתראה המופעלת.

למטה מוצגת דוגמה לתשובה.

[
  {
    "id": "80cbe560-f6e0-475c6f7ed2d",
    "shared_id": "4fa49a87-3463023ea7c4",
    "organization": "myorg",
    "environment": "prod",
    "name": "PublicAPI latency alert",
    "type": "Alert",
    "source": "null/current",
    "raw_payload": "{\"reportUUID\":\"\",\"reportEnabled\":false,\"organization\":\"myorg\",\"name\":\"emgmt-api 404\",\"self\":\"/alerts/4fa49a87-3463023ea7c4\",\"description\":\"go/apigee-extensions-playbook\",\"conditions\":[
  {\"comparator\":\">\",\"metric\":\"rate\",\"durationSeconds\":300,\"name\":\"PublicAPI latency alert\",\"description\":\"\",\"threshold\":0.05,\"dimensions\":{\"proxy\":\"emgmt-api\",\"org\":\"myorg\",\"env\":\"prod\",\"region\":\"any\",\"statusCode\":\"404\"}}],\"uuid\":\"4fa49a87-3463023ea7c4\",\"playbook\":\"go/apigee-extensions-playbook\"}",
    "time": "2019-03-25T15:30:18Z"
  },
  {
    "id": "9fc442d5-d607-40ef118c4e7",
    "shared_id": "4fa49a87-3463023ea7c4",
    "organization": "myorg",
    "environment": "prod",
    "name": "PublicAPI latency alert",
    "type": "Alert",
    "source": "null/current",
    "raw_payload": "{\"reportUUID\":\"\",\"reportEnabled\":false,\"organization\":\"myorg\",\"name\":\"emgmt-api 404\",\"self\":\"/alerts/4fa49a87-3463023ea7c4\",\"description\":\"go/apigee-extensions-playbook\",\"conditions\":[{\"comparator\":\">\",\"metric\":\"rate\",\"durationSeconds\":300,\"name\":\"PublicAPI latency alert\",\"description\":\"\",\"threshold\":0.05,\"dimensions\":{\"proxy\":\"emgmt-api\",\"org\":\"myorg\",\"env\":\"prod\",\"region\":\"any\",\"statusCode\":\"404\"}}],\"uuid\":\"4fa49a87-3463023ea7c4\",\"playbook\":\"go/apigee-extensions-playbook\"}",
    "time": "2019-03-25T15:17:55Z"
  },
 ...
]

מגדירים את $ACCESS_TOKEN לאסימון הגישה מסוג OAuth 2.0, כמו שמתואר במאמר קבלת אסימון גישה מסוג OAuth 2.0.

למידע על אפשרויות cURL המשמשות בדוגמה זו, ראה שימוש ב-cURL.