Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

cURL Variable as Attachment to Alert API

Andrew Katz March 14, 2023

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!

1 answer

1 accepted

0 votes
Answer accepted
Justin Sitarz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 16, 2023

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events