<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Read raw data stream using REST API from non-Sharepoint Server</title><link>https://www.infopathdev.com:443/forums/thread/104776.aspx</link><pubDate>Sun, 22 Nov 2015 01:52:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:104776</guid><dc:creator>jeffh</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/104776.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=104776</wfw:commentRss><description>I am new to Infopath and have some experience with writing Excel macros in vba. I have an infopath form that once it is filled out by users it needs to be sent (&amp;quot;submitted&amp;quot;) to a non-sharepoint server using the REST API. The format of the REST data is proprietary and so I need to parse the return data from a REST &amp;quot;GET&amp;quot; command with my own logic. Basically I will issue a REST &amp;quot;GET&amp;quot; to query the system and locate a unique ID, that I will turn around and update with new content using a REST &amp;quot;POST&amp;quot;. I have experimented a bit with the code below but it is returning the error &amp;quot;Data at the root level is invalid. Line 1, position 1.&amp;quot;. But the bigger issue is that I think my approach is all wrong. I think I would be better off is I could issue the &amp;quot;GET&amp;quot; command and return the text as a stream that I could parse, rather than XML which I believe will always be a problem because of the data format. If someone could point me in the right direction I would appreciate it greatly.

            Dim resolver As New XmlUrlResolver()
            resolver.Credentials = System.Net.CredentialCache.DefaultCredentials

            &amp;#39; Point the resolver at the desired resource and resolve as a stream.
            Dim baseUri As New Uri(&amp;quot;http://xxx.xx.xxx.x:80/tip/rest/v1/model/&amp;quot;)
            Dim fulluri As Uri = resolver.ResolveUri(baseUri, &amp;quot;application?orderby=name&amp;amp;select=name&amp;amp;limit=60&amp;amp;pretty=true&amp;quot;)
            Dim s As Stream
            s = CType(resolver.GetEntity(fulluri, Nothing, GetType(Stream)), Stream)

            &amp;#39; Create the reader with the resolved stream and display the data.
            Dim reader As XmlReader = XmlReader.Create(s)
            While reader.Read()
                Console.WriteLine(reader.ReadOuterXml())
            End While

REST API Command and return data format:

This command returns a list of the first 60 applications in the database: http://xxx.xx.xxx.x:80/tip/rest/v1/model/application?orderby=name&amp;amp;select=name&amp;amp;limit=60&amp;amp;pretty=true

The return data format is:
{
  &amp;quot;model&amp;quot; : [ {
    &amp;quot;_id&amp;quot; : &amp;quot;1969D1FC-2CE2-411B-9534-7F6B71C60513&amp;quot;,
    &amp;quot;_type&amp;quot; : &amp;quot;Application&amp;quot;,
    &amp;quot;name&amp;quot; : &amp;quot;Office 2010 Suite&amp;quot;
  }, {
    &amp;quot;_id&amp;quot; : &amp;quot;1C206CED-F009-48C7-AC1B-72BD51D67E6B&amp;quot;,
    &amp;quot;_type&amp;quot; : &amp;quot;Application&amp;quot;,
    &amp;quot;name&amp;quot; : &amp;quot;Adobe Reader XI&amp;quot;
  }, {
    &amp;quot;_id&amp;quot; : &amp;quot;B18CCC04-1B5F-4C35-AA47-0802BBB2D949&amp;quot;,
    &amp;quot;_type&amp;quot; : &amp;quot;Application&amp;quot;,
    &amp;quot;name&amp;quot; : &amp;quot;Active Directory Request&amp;quot;
  }, ]
}</description></item></channel></rss>