[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 :
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
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/
very interesting, could you give me some code examples or requests how it works )
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
Now you can access your base method like this from the browser :
http://yourdomain/base/CustomData/Getdata/<id>;
Dave
is working on a reply...