0

how to Get value from http response xml and pass it as a field in next http request field or save it in a variable power automate MY flow enter image description here

Response i get is in xml as below enter image description here

response what i get as xml

<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://qualysapi.qg3.apps.qualys.com/qps/xsd/3.0/was/webappauthrecord.xsd">
  <responseCode>SUCCESS</responseCode>
  <count>1</count>
  <data>
    <WebAppAuthRecord>
      <id>981337</id>
      <name><![CDATA[update1TEST]]></name>
      <owner>
        <id>266</id>
        <username>test</username>
        <firstName><![CDATA[API]]></firstName>
        <lastName><![CDATA[test]]></lastName>
      </owner>
      <formRecord>
        <type>STANDARD</type>
        <sslOnly>true</sslOnly>
        <authVault>false</authVault>
        <seleniumCreds>false</seleniumCreds>
        <fields>
          <count>2</count>
          <list>
            <WebAppAuthFormRecordField>
              <id>1006189</id>
              <name><![CDATA[username]]></name>
              <value><![CDATA[john]]></value>
            </WebAppAuthFormRecordField>
            <WebAppAuthFormRecordField>
              <id>1006190</id>
              <name><![CDATA[password]]></name>
              <value><![CDATA[*****]]></value>
            </WebAppAuthFormRecordField>
          </list>
        </fields>
      </formRecord>
      <tags>
        <count>1</count>
        <list>
          <Tag>
            <id>36715192</id>
            <name><![CDATA[app_automation]]></name>
          </Tag>
        </list>
      </tags>
      <comments>
        <count>1</count>
        <list>
          <Comment>
            <contents><![CDATA[some comments]]></contents>
            <createdDate>2022-12-03T06:47:19Z</createdDate>
          </Comment>
        </list>
      </comments>
      <createdDate>2022-12-03T06:47:19Z</createdDate>
      <createdBy>
        <id>26608662</id>
        <username>test</username>
        <firstName><![CDATA[API]]></firstName>
        <lastName><![CDATA[th]]></lastName>
      </createdBy>
      <updatedDate>2022-12-03T06:47:19Z</updatedDate>
      <updatedBy>
        <id>26608662</id>
        <username>test</username>
        <firstName><![CDATA[API]]></firstName>
        <lastName><![CDATA[th]]></lastName>
      </updatedBy>
    </WebAppAuthRecord>
  </data>
</ServiceResponse>

Tied below: enter image description here

Is there a way to get the value 981337 as variable which can be passed to next http request.

Tried below as well based on inputs but fails enter image description here

1 Answer 1

0

You have only missed to use "text()" function to get node value. Try below XPath and it should work:

/ServiceResponse/data/WebAppAuthRecord/id/text()

Make sure that above will return result as array even if we have single node in XML so while using it make sure that you use as below:

outputs('{Your Compose Action Name}')?[0]

enter image description here

Flow Output:

enter image description here

2
  • Added the same in question but fails can you help what could be the issue bit new to power automate. Dec 3, 2022 at 14:00
  • Thanks that worked. Dec 4, 2022 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.