Opsgenie attachment API's

Hello everyone,

I’m currently facing an issue while trying to fetch an attachment from OpsGenie using their API. Here’s a brief overview of what’s happening:

I am attempting to download an attachment associated with an alert using the OpsGenie API. I followed the standard procedure to retrieve the attachment ID through the Attachments List API, and then I used that ID to make a subsequent call to fetch the attachment.

However, I am consistently getting an "Error fetching attachment content: Error: Failed to fetch attachment metadata: Not Found
"
error when using the attachment ID obtained from the API.

Steps Taken:

  1. I successfully retrieved the list of attachments for a specific alert using the following API call:

    GET https://api.opsgenie.com/v2/alerts/{alertId}/attachments
    

    This returned a list of attachments along with their IDs.

  2. I then attempted to fetch the content of an attachment using its ID:

    GET https://api.opsgenie.com/v2/alerts/{alertId}/attachments/{attachmentId}
    

    This resulted in the error: “attachment ID not found.”

  3. To troubleshoot, I decided to inspect the Network Tab in Chrome Developer Tools while accessing the attachment directly. I noticed that the URL obtained from there works perfectly and allows me to download the attachment without any issues.

  • It seems that there is a discrepancy between the attachment IDs retrieved via the API and the IDs or URLs used directly from the network tab.
  • The attachment ID obtained from the API does not work, while the one fetched directly from the network tab does.

Has anyone else experienced this issue? I would appreciate any insights or solutions. Is there a specific reason why the attachment ID from the API might not be valid, or could this be a bug in the OpsGenie API?

Thank you in advance for your help!

Edit: Adding documentation link