I'm trying to pull out the accountId based on an email address using automation.
When i try to validate web request config with a project key, I see the payload with my custom field value:
"customfield_10094": "my_email@email.com",
But when I log {{webResponses.body.first.accountId}}, it turns up empty. What am I doing wrong?
I have the same API using this:
And finally I'm get the web response using this variable: {{webResponse.body.accountId}}
Seeing your details, maybe you just need to avoid to get first in your web request response.
Have you tried this?
I updated with Web request body: EMPTY and {{webResponse.body.accountId}}, but still getting an empty value.
Audit logs:
Action details:
USER CONDITION
The following issues passed:
<key>
SEND WEB REQUEST
Successfully published web request
LOG ACTION
Log
my_email@email.com (customfield_10094) and <EMPTY> {{webResponse.body.accountId}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've also tried {{webResponse.body.emailAddress}} and {{webResponse.body.accountType}} and it returns nothing.
When I do run <jira_url>/rest/api/3/user/search?query=my_email@email.com, I get a json response and can see accountId, emailAddress, accountType and lots of other data.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To Header I'm using my token converted to base64. Similar to this: Basic XXXXX.
You can conver get this base64 converted token in Postman headers if you're using Postman to test or you can generate a base64 token converted using some websites, like this one: https://base64.guru/converter
In the left side fill the box with the content: your-email:your_api-token. Click to encode to base64. Then copy the result and in your automation your header need to be like this:
Basic your-token-x64
Here a full print of my automation rule to test it.
URL: https://jira_site/rest/api/3/user/search?query={{issue.customfield_XXXX}}
Method: GET
Web Request Body: EMPTY
And ensure that you has checked the option: Delay execution of subsequent rule actions until we've received a response for this web request
And it works perfectly. Could you review your web request and response body to ensure that is similar as this one?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thank you Fernando, encoding in 64 your-email:your_api-token also solved the issue for me
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.