1 answer
- 10-1
- Gabor Tavali
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?
- Francis Martens (Exalate)
You lost me
Are you already storing this information in cloud,
Where do you need these in server ...
Please provide much more context - thanks
- Gabor Tavali
Sorry if I was misunderstood.
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?
- 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 - 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?
- 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)
- 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?
- 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?
- 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" } ] }
- 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?
- Francis Martens (Exalate)
hmm - that might be the case although Exalate has been whitelisted to access user information.
- 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...
Currently in Exalate I get the following properties as a user from Jira Cloud:
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!