I'm trying to use the Cloud automation to get the users from the Jira REST api and then push them into Insight with an External import. However, the result I get from the smart value is transformed into non-JSON.
I'm doing a web request action with URL https://riada-labs.atlassian.net/rest/api/3/users/search
When logging the response {{webResponse.body}} from the call it has this non-JSON format:
{self=https://riada-labs.atlassian.net/rest/api/3/user?accountId=557058:48c598a0-ccda-49ca-b1c3-612a3e0df045, accountId=557058:48c598a0-ccda-49ca-b1c3-612a3e0df045, accountType=atlassian,
when it should be in JSON format (which I get in Postman):
[
{
"self": "https://riada-labs.atlassian.net/rest/api/3/user?accountId=557058:48c598a0-ccda-49ca-b1c3-612a3e0df045",
"accountId": "557058:48c598a0-ccda-49ca-b1c3-612a3e0df045",
"accountType": "atlassian",
"avatarUrls": {
Am I doing something wrong or how can I get a proper JSON formatted result? As I want to just do another web request with the result, I need to have a correctly formed JSON string.
automation for Jira shows you the object how it appears to it as that's how you can access the properties of JSON with automation for Jira. If you're trying to use this object outside of automation to post elsewhere. You should create your own JSON representation by using the dot notation.
[
{
"accountId": {{webResponse.body.accountId}}
}
]
Hi and thanks @Prince Nyeche
Weird behaviour that the automation engine reformats the response body.
However, with your help I got it to work. My JSON looks like this to create a JSON array of users:
"users": [
{{#webResponse.body.values}} {
"accountId": "{{accountId}}",
"displayName": "{{displayName}}",
"active": "{{active}}"
}{{^last}}, {{/}}
{{/}}
]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
it is not reformatting it, it is decoding JSON to an internal object, where you can access all its elements
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm trying to do the same thing. But I'm not able to get web response. Nothing shows when I print {{webResponse.body}} in the log. What Am I missing here?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kaushik Battu,
Your result is [ ], which is an empty list and indicates that there were no results.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.