Copied to clipboard

Flag this post as spam?

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


  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Apr 04, 2013 @ 15:24
    Alex Skrypnyk
    0

    WEB API umbraco 4.11.1

    Hi everyone,

    What is the best way to use umbraco data from another project via HTTP ?

    Something like RESTful web api?

    Thanks,

    Alexandr

  • Dave Woestenborghs 3325 posts 11170 karma points MVP 5x admin c-trib
    Apr 04, 2013 @ 16:04
    Dave Woestenborghs
    100

    In version 4.x and 6.0.x you can use base for this : http://our.umbraco.org/documentation/reference/Api/Base/Index

    From version 6.1 there will be a Umbraco Web Api controller available : http://our.umbraco.org/documentation/reference/WebApi/

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Apr 04, 2013 @ 17:27
    Alex Skrypnyk
    0

    very interesting, could you give me some code examples or requests how it works )

  • Dave Woestenborghs 3325 posts 11170 karma points MVP 5x admin c-trib
    Apr 05, 2013 @ 10:27
    Dave Woestenborghs
    1

    There is some more information on Umbraco base in the umbraco TV video's : http://umbraco.com/help-and-support/video-tutorials/developing-with-umbraco/base-and-ajax-development.aspx

     

    Here is a small code example

    [RestExtension("CustomData")]
    public class DataService
    {
      [RestExtensionMethod(returnXml = false, allowAll = true)]
      public static void Getdata(int id)
      {
        var json = //get your json data here
    
        // Write response and set content type
        HttpContext.Current.Response.ContentType = "application/json";
        HttpContext.Current.Response.Write(json);
      }
    }

    Now you can access your base method like this from the browser :

    http://yourdomain/base/CustomData/Getdata/<id>;

    Dave

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies