0 Replies Latest reply on May 13, 2013 12:14 PM by Androo

    REST Custom XML Output

    Androo

      Hi,

       

      I've spent the last few days working with CF's implementation of REST and I love it. I can return XML as well as JSON from a query. The mobile app developer however says he needs the xml with special output.

       

      So for example, ColdFusion outputs the following:

       

      <QUERY ID="1">

           <COLUMNNAMES>

                <COLUMN NAME="VENDOR_NAME"/>

                <COLUMN NAME="ID"/>

           </COLUMNNAMES>

           <ROWS>

                <ROW>

                     <COLUMN TYPE="STRING">ADVANCED INTERSTATE</COLUMN>

                     <COLUMN TYPE="STRING">ABC123</COLUMN>

                </ROW>

                <ROW>

                     <COLUNM TYPE="STRING">M-AMERICA INC</COLUMN>

                     <COLUMN TYPE="STRING">DEF456</COLUMN>

                </ROW>

           </ROWS

      </QUERY>

       

      The mobile app developer says he needs it this way:

      <vendors type="array">

           <vendor>

                <id type="integer">7</id>

                <name>ADVANCED INTERSTATE</name>

                <api-key>ABC123</api-key>

           </vendor>

           <vendor>

                <id type="integer">5</id>

                <name>M-AMERICA INC</name>

                <api-key>DEF456</api-key>

           </vendor>

      </vendors>    

       

      So, based on my understanding, QUERY= ID="1" needs to read VENDORS type="array", and so on.

       

      Can I modify any of the output in order to match what the mobile app developer wants? Thank you.

       

      Sincerely,

      Andy