Setting variables in xml response data

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

Here’s an outline with best practices for making your inquiry.

My question:
im trying to get and set id from following xml response and want to use that id for rest of my api calls please help

Details (like screenshots):

<?xml version="1.0" encoding="UTF-8"?>
<responseCode>SUCCESS</responseCode>

<count>1</count>

<data>

    <WebApp>

        <id>57389694</id>

        <name>

            <![CDATA[aral1]]>

        </name>

        <url>

            <![CDATA[https://aral-de-cm.navitas.bpglobal.com/de/global/retail/pulse.html/]]>

        </url>

        <owner>

            <id>3689215</id>

            <username>bpeut5hy</username>

            <firstName>

                <![CDATA[Holla]]>

            </firstName>

            <lastName>

                <![CDATA[Yamini]]>

            </lastName>

        </owner>

        <scope>LIMIT</scope>

        <attributes>

            <count>0</count>

        </attributes>

        <defaultProfile>

            <id>1859428</id>

            <name>

                <![CDATA[Default Option profile for WAS]]>

            </name>

        </defaultProfile>

        <defaultScanner>

            <type>EXTERNAL</type>

        </defaultScanner>

        <scannerLocked>false</scannerLocked>

        <progressiveScanning>false</progressiveScanning>

        <urlBlacklist>

            <count>0</count>

        </urlBlacklist>

        <urlWhitelist>

            <count>0</count>

        </urlWhitelist>

        <postDataBlacklist>

            <count>0</count>

        </postDataBlacklist>

        <logoutRegexList>

            <count>0</count>

        </logoutRegexList>

        <authRecords>

            <count>0</count>

        </authRecords>

        <dnsOverrides>

            <count>0</count>

        </dnsOverrides>

        <useRobots>IGNORE</useRobots>

        <useSitemap>false</useSitemap>

        <malwareMonitoring>false</malwareMonitoring>

        <malwareNotification>false</malwareNotification>

        <tags>

            <count>0</count>

        </tags>

        <comments>

            <count>0</count>

        </comments>

        <isScheduled>false</isScheduled>

        <createdBy>

            <id>3689215</id>

            <username>bpeut5hy</username>

            <firstName>

                <![CDATA[Holla]]>

            </firstName>

            <lastName>

                <![CDATA[Yamini]]>

            </lastName>

        </createdBy>

        <createdDate>2022-03-05T10:51:00Z</createdDate>

        <updatedBy>

            <id>3689215</id>

            <username>bpeut5hy</username>

            <firstName>

                <![CDATA[Holla]]>

            </firstName>

            <lastName>

                <![CDATA[Yamini]]>

            </lastName>

        </updatedBy>

        <updatedDate>2022-03-05T10:51:00Z</updatedDate>

        <config/>

        <crawlingScripts>

            <count>0</count>

        </crawlingScripts>

    </WebApp>

</data>

what script can i use to capture webapp id please share some samples

Hey @yamini.holla :wave:
You can store the webApp id in an environment variable, but you need to convert the XML response to json to handle the data.

var jsonObject = xml2Json(responseBody);