Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Trent 15 posts 103 karma points
    Oct 06, 2014 @ 23:34
    Trent
    0

    Parsing API Data In C#

    I am wanting to call my umbraco API from C#. At the moment my API is returning the information of some Nodes, how do I go about calling and parsing this data in a seperate .NET project? I have tried using HttpWebRequest and parsing the result as JSON and XML but nothing seems to be working.

    The response I get form the API below:

    Thanks

    <ArrayOfAPIDataModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/SportsAuckland.CMS.Models"><APIDataModel><Alias>introText</Alias><Value>A successful sports club is vibrant through opportunity and visible though capability. Develop Your Legacy is an interactive knowledge library and club cloud that can be used as a development tool enabling your club to assemble, work through and deliver their own continuous development strategies as well as future proofing your club through succession planning.</Value></APIDataModel><APIDataModel><Alias>layFoundation</Alias><Value>This is the heartbeat of your club and if solid foundations are laid your club will be able to build on its personality and legacy which will lead to continuous development and improvement.</Value></APIDataModel><APIDataModel><Alias>buildTheStructure</Alias><Value>Focus on building the support structure for your club members, volunteers and staff, ensuring ongoing capability to meet operational needs and expectations.</Value></APIDataModel><APIDataModel><Alias>cementTheLegacy</Alias><Value>Forward thinking is essential to Develop Your Legacy. It is all about standing out from the crowd and with strong foundations and support structure; your club can look to the future to develop, grow and improve.</Value></APIDataModel></ArrayOfAPIDataModel>
  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Oct 07, 2014 @ 12:13
    Jeroen Breuer
    0

    Hello,

    There is an Umbraco console app that shows how to use the Umbraco API in an external project: https://github.com/sitereactor/umbraco-console-example

    Jeroen

  • Andy Butland 422 posts 2334 karma points MVP 4x hq c-trib
    Oct 08, 2014 @ 16:44
    Andy Butland
    0

    Sounds like in this instance you have your data exposed though, and hence it would just be standard .Net techniques for retrieving XML or JSON from an external URL, and then parsing that to do what you need to do with it.  That looks like valid XML so presuming that's what your separate application is retrieving you can do something like:

        var doc = XDocument.Load(url);
    

    And from there do what you need to do with your XML.

    Andy

Please Sign in or register to post replies

Write your reply to:

Draft