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
Good afternoon Everyone,
I am looking into OG alert API (and perhaps a python wrapper) at https://docs.opsgenie.com/docs/python-sdk-alert, and I cannot find triggerUrl and triggerDescription parameters in the json'ized parameter set. Anyone knows how can I get a handle on these?
The `triggerUrl` and `triggerDescription` parameters won't be directly available in the OpsGenie Alert API. However, you can potentially use custom fields to include this information in an alert.
I will send you some suggestions below:
Looking at the OpsGenie Alert API documentation, you can pass extra properties as a dictionary using the `details` parameter when you create an alert. For example, you can do something like this:
from opsgenie.swagger_client import AlertApi, AddAlertRequest, UserRecipient, TeamRecipient
from opsgenie.swagger_client.models import CreateAlertNoteRequest
from opsgenie.swagger_client.rest import ApiException
alert_api = AlertApi()
body = AddAlertRequest(
message="Server CPU Usage High",
description="CPU Utilization has reached 90%",
"triggerDescription": "This is the trigger description"
response = alert_api.create_alert(body=body)
except ApiException as err:
print("Exception when calling AlertApi->create_alert: %s\n" % err)
In this example, we're using the `details` dictionary to add custom fields for `triggerUrl` and `triggerDescription`. Note that these fields should then be accessible in the alert details on the OpsGenie user interface.
Let me know if the information above was indeed useful.
Yes, the payload can be manipulated like:
body = og.CreateAlertPayload(
message='Message from: ' + datetime.datetime.utcnow().isoformat(),
entity='pack1/' + str(uuid.uuid1()),
Thank you for your reply!