How to get the AccountId of an Opsgenie user?

Olav Aukan January 31, 2022

I'm trying to create some basic automation flows using the REST API, more specifically I'm trying to create actions/task on a Confuence page and assign them to the user that is currently on watch for an Opsgenie scheduler, but the identifier returned by the Opsgenie API is not an AccountId. There doesn't seem to be any way to get that AccountId, and there is no way to match the user against the user returned by the Confluence API since there is no "get user by email" method....

The Opsgenie instance is already using Atlassian login, so how is this supposed to work? The AccountId is supposed to be the unique identifier across all the Atlassian products, but it seems that Opsgenie still uses it's own identifier...

This is all in the cloud, not on-prem, and without any changes to the default setup.

1 answer

1 accepted

0 votes
Answer accepted
Samir
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 31, 2022

Hi @Olav Aukan 

 

In Opsgenie, each user has a username (i.e. their login email), and a User ID.

 

If you have the user's email address, you can make a Get User API request using the user's email address (i.e. "username") to get the user's Opsgenie User ID.

 

You can also List Users to return a list of all users, with their associated User ID's.

 

Hope this helps!

 

Thanks,

Samir

Olav Aukan January 31, 2022

Hi @Samir 

Thank you for the quick response. I am aware of these two endpoints to retrieve users, but the problem is that the responses don't contain the AccountId of the users.

The AccountId and the User ID are tho different identifications, and I can't use a users User Id from Opsgenie to retrieve the corresponding user in Confluence since Confluence only allows you to query users by AccountId.

You can see the difference in the format of the Ids. The User ID in Opsgenie is a Guid (f7713593-fafe-4346-abc9-e34b0a940f43) but the AccountId in Confluence (and other Atlassian products) is the organization id, followed by a colon and the a Guid (123456:50a1dfb1-61ef-413d-bae4-c1cc2d6e8db9). The Guid-part of the Ids are also different for each product. 

So the question then is if there is a way to get the AccountId of a user based on the users ID in Opsgenie?

Samir
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 31, 2022

Hi @Olav Aukan ,

 

Thanks for clarifying. I think the issue is these are 2 different API's. There's the Opsgenie API, which doesn't use nor return the Atlassian ID, then there's the Atlassian User Management API.

 

The Opsgenie API's do not return any information about the associated Atlassian User account. It doesn't look like the Atlassian Cloud User API allows you to use emails/usernames as identifiers, so there wouldn't be a way to an associated Atlassian User ID given an Opsgenie user id/username.

 

I can enter a feature request for the Opsgenie User API to return the associated Atlassian User's AccountID. (Opsgenie user is linked to an associated Atlassian User account by their login email).

Like # people like this
Olav Aukan February 1, 2022

Hi again @Samir 

A feature request for this would be brilliant, Like you said, there is already a link between the Opsgenie account and the Atlassian account, so maybe it's a quick feature to implement.

Thanks for the help so far!

Benjamin Smedberg December 12, 2022

@Samir do you have a link to this feature request? This problem is affecting us at Xometry also, as we are also trying to create automation that will auto-assign incoming support tickets to opsgenie on-call rotations.

Ben Salvage August 8, 2023

Is there an update from any of the participants in this thread? We too would like to do an automation based on the Opsgenie on-call rotations

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events