Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I need to build Umbraco Web API that will return JSON containing values of created document types, but I can't find any clear explanation on how to do so. I'm relatively new to APIs and I don't know if I need to provide anything else (if I do, please say so and I will). Thanks in advance!
You basically write a regular/standard .Net Web Api but inherit from UmbracoApiController instead of ApiController and the routing/url to the Api will be ~/Umbraco/Api/[YourControllerName].
See more info here:
Thank you for answering. Problem was that I was using VS Code. When I switched to VS everything went smoothly, but now I don't know how to get Document Types for CRUD methods. If you know how to do that, please help me.
Talking in general terms you would for reading Umbraco data use the Umbraco helper since it's cached. See https://our.umbraco.com/documentation/Reference/Querying/UmbracoHelper/. Typically:
IPublishedContent content = Umbraco.Content(id);
For create, update, delete you would have to look at the different services available: https://our.umbraco.com/documentation/Reference/Management/Services/
What I haven't found is how you get the properties of the document type as JSON. I can easily create an API end point in Umbraco that returns a static string. Other than looking at some of Matt's code, there appears to be no documentation beyond the creation of a simple end point.
With Umbraco Headless not out yet, needing to wait until the x.1 version is out and stable, and the downside of it not working on prem, we need better documentation to create our own headless that can compete with the other open source solutions.
My experience is that to return json from a Web Api using Umbraco is no different from a standard .Net Web Api, i.e.:
The only part that I know of that is different is the routing, otherwise I write my .Net Web Apis using Umbraco the same I would when not using Umbraco.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted