Questions for Confluence license has expired.

Please purchase a new license to continue using Questions for Confluence.

Is it possible to get expanded user information from Jira Cloud?

 
2
1
0

Currently in Exalate I get the following properties as a user from Jira Cloud:


{
      "key": "",
      "active": ,
      "email": "",
      "displayName": ""
    }

Is it possible to get more details about the Jira user? I mean I have more properties in Jira side (e.g phone number, some other ids, etc...), customs as well. It would be nice if somehow I could be able to get those information as well. 


Thank you!

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hello Gabor Tavali


      Where is this information stored?


      1. Gabor Tavali

        Hey Francis Martens (iDalko)


        We have some extra user information in Jira (company ids). It can be anywhere in Jira side, the question is, where should we store them if we want to get it in Exalate?

      2. Francis Martens (Exalate)

        You lost me (smile)

        Are you already storing this information in cloud,

        Where do you need these in server ...


        Please provide much more context - thanks

      3. Gabor Tavali

        Sorry if I was misunderstood. (smile) 

        I'd like to store some extra information for all users (employee id) in Jira Cloud, but it doesn't matter where. We can put the custom information anywhere in Jira you prefer. The goal is to get that custom user field in Exalate when we define the mapping rules.

        Is it possible?

      4. Francis Martens (Exalate)

        Ah - you would like to add to a user specific values.

        Do you know if there is a rest api for this entity type?

        You can then use the JiraClient to set/access that information


        Check for an example
        https://docs.idalko.com/exalate/x/BoEAAg



      5. Gabor Tavali

        Thank you, it's useful! I give it a try!

      6. Gabor Tavali

        Francis Martens (Exalate) I've tried the JiraClient based on your example:


        def wc = new JiraClient(httpClient)
                def groupsResultStr = wc.http(
                        "GET",
                        "/rest/api/3/user/properties",
                        ["accountId":"5ce5eec03b428d0dcd7cac19"],
                        null,
                        [:]
                )


        I got the following error:


        Script error for issue ST-26. Details: Failed to perform the request GET /rest/api/3/user/properties (status 404), and body was: ```null``` Please contact Exalate Support: {"errorMessages":["Specified user does not exist or you do not have required permissions"],"errors":{}}. Error line: JiraClient.groovy:88


        The error is on the Jira side. Could you help in this issue?

      7. Juan Grases

        Hi! There is an easier way to interact with the Jira Cloud REST API:

        def userProperties = httpClient.get("/rest/api/3/user/properties?accountId=5ce5eec03b428d0dcd7cac19")

        No need to do any json parsing on the result (userProperties), is already parsed into a groovy Map.


        Could you try this way? Make sure the request you try is valid (you can test directly on your browser)

      8. Gabor Tavali

        Hi Juan Grases  ,

        Thanks for the answer! I've tried but I got null object.


        def userProperties = httpClient.get("/rest/api/3/user/properties?accountId=5ce5eec03b428d0dcd7cac19")
        def keys = userProperties.keys

         The error is the following:


        Script error for issue ST-26. Details: Cannot get property 'keys' on null object. Error line: Script403.groovy:23


        In a browser I can get answer for that accountId. What could be the problem?


      9. Juan Grases

        Could you share what is the answer you get from the browser when doing /rest/api/3/user/properties?accountId=5ce5eec03b428d0dcd7cac19 on your Jira Cloud?

      10. Gabor Tavali

        Sure!

        {
        "keys": [
        {
        "self": "https://***.atlassian.net/rest/api/3/user/properties/growth-nux?accountId=5ce5eec03b428d0dcd7cac19",
        "key": "growth-nux"
        },
        {
        "self": "https://***.atlassian.net/rest/api/3/user/properties/jsw-onboarding-checklist.create-project-task?accountId=5ce5eec03b428d0dcd7cac19",
        "key": "jsw-onboarding-checklist.create-project-task"
        },
        {
        "self": "https://***.atlassian.net/rest/api/3/user/properties/jsw-onboarding-checklist.onboarding-status?accountId=5ce5eec03b428d0dcd7cac19",
        "key": "jsw-onboarding-checklist.onboarding-status"
        },
        {
        "self": "https://***.atlassian.net/rest/api/3/user/properties/jsw-onboarding-checklist.open?accountId=5ce5eec03b428d0dcd7cac19",
        "key": "jsw-onboarding-checklist.open"
        },
        {
        "self": "https://***.atlassian.net/rest/api/3/user/properties/jsw-onboarding-checklist.open-task?accountId=5ce5eec03b428d0dcd7cac19",
        "key": "jsw-onboarding-checklist.open-task"
        }
        ]
        }
      11. Gabor Tavali

        Hey Juan Grases

        Do you have any idea why I get null object instead of the above?

        Is it possible that the Jira user who initiates the REST call on behalf of Exalate, it doesn't have appropriate permissions? 

      12. Francis Martens (Exalate)

        hmm - that might be the case although Exalate has been whitelisted to access user information.

      13. Gabor Tavali

        We're gonna check it! Thanks! The user who initiates the call, is the same as the reporter user "Exalate" after a successful sync?

      CommentAdd your comment...