Hello,
Is there a way to use cURL to add a variable as an attachment to an alert using the Alert API in OpsGenie?
The documentation shows how to do this using a file on the filesystem, but I am hoping to include a BASE64-encoded variable of a string/some JSON and upload that as an attachment instead.
Is this possible through the OpsGenie Alert API? I have tried a number of ways of formatting it but still getting a 400 error saying:
Required request part 'file' is not present
Thank you!
Hi Andrew!
Justin here, from Opsgenie support - happy to help!
An alert attachment is required to be a file, so in your example, you would probably want to generate a file (perhaps just a .txt or .json file) locally, containing your string or JSON prior to making the actual request to Opsgenie to add that newly generated file as an attachment.
If you're wanting to simply add some plain text to an alert, your best option would instead be to add it as a note, using the Add Note method outlined here:
https://docs.opsgenie.com/docs/alert-api#add-note-to-alert
Let me know if that helps to answer your question, or if there's anything else I could assist with!
Best,
Justin Sitarz
Cloud Support Engineer, Opsgenie
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.