You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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
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:
Let me know if that helps to answer your question, or if there's anything else I could assist with!
Cloud Support Engineer, Opsgenie