WebResponse returns empty list though webrequest was successful

Ankathi_Madhuritha December 20, 2024

Hi ,
I have been working on an automation , as part of it I want to compare the value of a property in my JSON payload and store it.
I have sent a webrequest and it was successful , but {{webResponses.last.body}} returns an empty list [] . I could not find the reason as when I validated the webrequest I get the following payload


[ { "id": 12, "name": "ACI", "mappedProjectId": 0, "createNewVersion": true, "deploymentConfiguration": { "showBuildNumber": true, "showDescription": true, "preventDeploymentMerge": false, "readonlyDeployedIssues": false, "preventJiraDeploymentSync": false } }, { "id": 9, "name": "AEM", "mappedProjectId": 0, "createNewVersion": true, "deploymentConfiguration": { "showBuildNumber": true, "showDescription": true, "preventDeploymentMerge": false, "readonlyDeployedIssues": false, "preventJiraDeploymentSync": false } } ] 

I want to compare the name with a issue field and store the respective id . 
Could someone help or share your thoughts ?

Thanks in Advance !!

1 answer

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 20, 2024

Hi @Ankathi_Madhuritha 

For a question like this, context is important for the community to help.  Please post the following:

  • what type of project is this (e.g., company-managed, team-managed, etc.), 
  • an image of your complete automation rule,
  • images of any relevant actions / conditions / branches,
  • an image of the audit log details showing the rule execution, and
  • explain what is not working as expected.

Until we see those...

What are you expecting the response to contain: a single response, or zero-to-many?

To confirm what the rule is receiving, I recommend writing these to the audit log (in separate Log actions) after the Send Web Request action to confirm the structure:

web responses size: {{webResponses.size|0}}

web response bodies: {{webResponses.body}}

web response body size: {{webResponse.body.size|0}}

web response body: {{webResponse.body}}

 

Kind regards,
Bill

Ankathi_Madhuritha December 23, 2024
  • what type of project is this (e.g., company-managed, team-managed, etc.),  -- company-managed
  • an image of your complete automation rule, Screenshot 2024-12-23 141035.pngScreenshot 2024-12-23 141244.png

  • images of any relevant actions / conditions / branches,
  • an image of the audit log details showing the rule execution, and 
    Screenshot 2024-12-23 141348.png
  • explain what is not working as expected. - I want to traverse through the JSON payload that I retrieved by webrequest and compare the application attribute in it with one of my customfields value and store the corresponding id of it.
    Below is the JSON for your reference
    [
      {
        "id": 12,
        "name": "ACI",
        "mappedProjectId": 0,
        "createNewVersion": true,
        "deploymentConfiguration": {
          "showBuildNumber": true,
          "showDescription": true,
          "preventDeploymentMerge": false,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      },
      {
        "id": 9,
        "name": "AEM",
        "mappedProjectId": 0,
        "createNewVersion": true,
        "deploymentConfiguration": {
          "showBuildNumber": true,
          "showDescription": true,
          "preventDeploymentMerge": false,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      },
      {
        "id": 13,
        "name": "AEM publisher",
        "mappedProjectId": 10004,
        "createNewVersion": false,
        "deploymentConfiguration": {
          "showBuildNumber": true,
          "showDescription": true,
          "preventDeploymentMerge": false,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      },
      {
        "id": 11,
        "name": "Automic",
        "mappedProjectId": 0,
        "createNewVersion": true,
        "deploymentConfiguration": {
          "showBuildNumber": true,
          "showDescription": true,
          "preventDeploymentMerge": false,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      },
      {
        "id": 4,
        "name": "BPS",
        "mappedProjectId": 10000,
        "createNewVersion": true,
        "deploymentConfiguration": {
          "showBuildNumber": true,
          "showDescription": true,
          "preventDeploymentMerge": false,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      },
      {
        "id": 7,
        "name": "Buying Tool",
        "mappedProjectId": 0,
        "createNewVersion": true,
        "deploymentConfiguration": {
          "showBuildNumber": true,
          "showDescription": true,
          "preventDeploymentMerge": false,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      },
      {
        "id": 5,
        "name": "DemoApplication",
        "mappedProjectId": 10002,
        "createNewVersion": true,
        "deploymentConfiguration": {
          "showBuildNumber": true,
          "showDescription": true,
          "preventDeploymentMerge": false,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      },
      {
        "id": 1,
        "name": "eCommerce",
        "createNewVersion": false,
        "deploymentConfiguration": {
          "showBuildNumber": true,
          "showDescription": true,
          "preventDeploymentMerge": false,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      },
      {
        "id": 2,
        "name": "ERP",
        "createNewVersion": false,
        "deploymentConfiguration": {
          "showBuildNumber": true,
          "showDescription": true,
          "preventDeploymentMerge": false,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      },
      {
        "id": 6,
        "name": "HYPERION",
        "mappedProjectId": 0,
        "createNewVersion": true,
        "deploymentConfiguration": {
          "showBuildNumber": true,
          "showDescription": true,
          "preventDeploymentMerge": false,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      },
      {
        "id": 8,
        "name": "Jira",
        "versionPrefix": "J",
        "mappedProjectId": 10002,
        "createNewVersion": true,
        "deploymentConfiguration": {
          "showBuildNumber": true,
          "showDescription": true,
          "preventDeploymentMerge": true,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      },
      {
        "id": 15,
        "name": "JOOR",
        "createNewVersion": false,
        "deploymentConfiguration": {
          "showBuildNumber": false,
          "showDescription": false,
          "preventDeploymentMerge": false,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      },
      {
        "id": 17,
        "name": "Metapack",
        "createNewVersion": false,
        "deploymentConfiguration": {
          "showBuildNumber": false,
          "showDescription": false,
          "preventDeploymentMerge": false,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      },
      {
        "id": 10,
        "name": "OROB",
        "mappedProjectId": 0,
        "createNewVersion": true,
        "deploymentConfiguration": {
          "showBuildNumber": true,
          "showDescription": true,
          "preventDeploymentMerge": false,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      },
      {
        "id": 3,
        "name": "Payment Service",
        "createNewVersion": false,
        "deploymentConfiguration": {
          "showBuildNumber": true,
          "showDescription": true,
          "preventDeploymentMerge": false,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      },
      {
        "id": 14,
        "name": "SAR Status",
        "mappedProjectId": 0,
        "createNewVersion": true,
        "deploymentConfiguration": {
          "showBuildNumber": true,
          "showDescription": true,
          "preventDeploymentMerge": false,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      },
      {
        "id": 16,
        "name": "WCS",
        "createNewVersion": false,
        "deploymentConfiguration": {
          "showBuildNumber": false,
          "showDescription": false,
          "preventDeploymentMerge": false,
          "readonlyDeployedIssues": false,
          "preventJiraDeploymentSync": false
        }
      }
    ]


    Thanks 
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 23, 2024

Thanks for that information.

The syntax you are using to "find" the smart value in the webResponse body is invalid and not a feature of automation rules.

And, the supported way to filter within a list iterator would not work for your case because data / fields outside the iterator scope are not visible inside.

Once possible workaround is to use a dynamic list search, where the needed webResponse values are expanded into text, stored in a created variable, and then a dynamic regular expression is built to find what is needed (using your customfield_10255).  If you want to try that approach, here is an article I wrote on the technique: https://community.atlassian.com/t5/Automation-articles/Automation-concepts-Dynamic-searches-within-a-list/ba-p/2834235

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events