Skip to main content

I’m attempting to retrieve incident & alert details, specifically the “To”, “From”, and “Body” from an incident that’s triggered via email. From a log_entries call, I’m able to fetch the channel type and summary but not the other fields I mentioned as well as “Subject”. 

The call i’m using:
curl -s -H "Authorization: Token token=<token>" -H "Accept: application/json" 'https://api.pagerduty.com/incidents/<incident_id>/log_entries

 

Example of a response:
{
      "id": "abc123",
      "type": "trigger_log_entry",
      "summary": "Triggered through email.",
      "self": "https://api.pagerduty.com/log_entries/abc123",
      "html_url": "https://finxact.pagerduty.com/incidents/def456/log_entries/abc123",
      "created_at": "2024-11-28T14:17:49Z",
      "agent": {
        "id": "PODSID1",
        "type": "generic_email_inbound_integration_reference",
        "summary": "Email",
        "self": "https://api.pagerduty.com/services/P5TB6FT/integrations/PODSID1",
        "html_url": "https://finxact.pagerduty.com/services/P5TB6FT/integrations/PODSID1"
      },
      "channel": {
        "type": "email",
        "summary": "Development Support"
      },
      "service": {
        "id": "PPTT123",
        "type": "service_reference",
        "summary": "Tech On Calls",
        "self": "https://api.pagerduty.com/services/PPTT123",
        "html_url": "https://finxact.pagerduty.com/service-directory/PPTT123"
      },
      "incident": {
        "id": "INC123",
        "type": "incident_reference",
        "summary": "#1234] Development Support",
        "self": "https://api.pagerduty.com/incidents/INC123",
        "html_url": "https://finxact.pagerduty.com/incidents/INC123"
      },
      "teams": o
        {
          "id": "TEAM123",
          "type": "team_reference",
          "summary": "FAST Technology",
          "self": "https://api.pagerduty.com/teams/TEAM123",
          "html_url": "https://finxact.pagerduty.com/teams/TEAM123"
        }
      ],
      "contexts": p],
      "event_details": {
        "description": "Development Support"
      }
    }

You will get more details about the triggering event within the channel property by adding the “channels” include when making the API call to get log entries, or List log entries for an incident (the options are the same for both endpoints) i.e.

GET https://api.pagerduty.com/log_entries?include&5B%5D=channels

Without include, the corresponding part of the response is more of a stub or resource reference. To include the full content of a related record, add its include, i.e. for the related incident, add the “incidents” include

GET https://api.pagerduty.com/log_entries?include&5B%5D=channels&include%5B%5D=incidents

Hopefully that helps.


Reply