Hi,
Attempting to add a responder via rest API to my alert, I am getting confused about the team id I have to use.
the API rest endpoint in question:
https://api.opsgenie.com/v2/alerts/:identifier/responders
As per the doco (https://docs.opsgenie.com/docs/alert-api#add0responder-to-alert), I should use the payload:
{
"responder": {
"type": "team",
"id": "TEAM_ID"
}
}
My question is on getting the TEAM_ID value.
We have recently moved to Jira integrated Ops genie experience from the standalone Ops Fenie, which results in using the Jira Atlassian teams, instead of native Ops Genie ones.
Setting the responders via the rest API, using the Jira Atlassian team ID , yields the error:
{
"success": false,
"action": "Add Responder",
"processedAt": "2024-08-06T01:35:19.345Z",
"integrationId": "",
"isSuccess": false,
"status": "Team with id [og-1c0cda02-XXX-XXX-XXX-e3f2d3399731] does not exist.",
"alertId": "",
"alias": ""
}
Looking further into it - i am able to get the list of these via GraphQL
https://team.atlassian.com/gateway/api/graphql
query example {
jira {
allJiraProjects(cloudId: "MY_CLOUD_ID", filter: {types: [SERVICE_DESK]}) {
pageInfo {
hasNextPage
}
edges {
node {
key
name
opsgenieTeamsAvailableToLinkWith {
pageInfo {
hasNextPage
}
edges {
node {
id
name
}
}
}
}
}
}
}
}
You can now use the Teams Public API: https://developer.atlassian.com/platform/teams/rest/v1/api-group-teams-public-api/#api-gateway-api-public-teams-v1-org-orgid-teams-get
It was implemented October 2024: https://jira.atlassian.com/browse/CLOUD-11862
The authentication is to use an Authorization header, with Basic base64_encoded_username:API_token
You can get an API token from https://id.atlassian.com/manage-profile/security/api-tokens
You can get the org id from admin.atlassian.com OR
https://sitename.atlassian.net/gateway/api/graphql
Run this:
query tenantData {
tenantContexts(hostNames: ["sitename.atlassian.net"]) {
cloudId
orgId
}
}
You should see your cloudId and your orgId:
{
"data": {
"tenantContexts": [
{
"cloudId": "redacted",
"orgId": "redacted"
}
]
},
"extensions": {
"gateway": {
"request_id": "186141fa756f48b484402dbb902a3d28",
"crossRegion": true,
"edgeCrossRegion": true
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is also possible to add responders by team name, like so
{
"responder": {
"type": "team",
"name": "My Team"
}
}
this works fine, for our case, however, it is possible that there are multiple Atlassian teams, named "My Team", and in such case - the assignment result is unpredictable, as we cannot guarantee, which of the "My Teams" the alert will be assigned to.
Having said that - I do not see any documentation, which describes how the assign responder by name functionality works, yet the API accepts such a payload and processes it successfully.
Please advise further
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.