I want to use Umbraco for one of my project backend to manage the contents. Besides just having the contents (webpages, images, docs, etc.), the website also has APIs also so that users can access contents through apis.
Is it possible to create APIs in Umbraco that has endpoint - /api/your_controller/method_name instead of /umbraco/surface/your_controller/method_name?
Has anyone used APIs in Umbraco in format /api/your_controller/method_name? How was your experience? Is that like a cake-walk?
Can someone please suggest which is best approach to take here? Should I rely of REST APIs (which is outside support cycle) or should choose Headless for api implementation.
It depends what you are trying to do. If you are still wanting to serve a full website as part of your Umbraco instance the Umbraco Headless offering might not be quite what you are after.
Additionally, there is a GraphQL experimental git repo here: https://github.com/rasmusjp/umbraco-graphql (I know this isn't a REST implementation but thought I'd mention it)
I have not had the opportunity to use Umbraco Rest APIs myself, but for the projects I have worked on so far, I used to write my own web API Controllers and action implementations to expose just the data I want to expose using the right Service (ContentService, MediaService etc)
Thanks for the reply. By default, apis we create in Umbraco has format /umbraco/api/controller/method or /umbraco/surface/controller/method.
I am looking for apis in Umbraco whose route looks like /api/controller/method. Is it possible to get that route which is more generic and common, instead of having /umbraco sticking to the api endpoint?
Is that something your were able to achieve when you developed APIs in Umbraco?
REST implementation in Umbraco
Hello,
I want to use Umbraco for one of my project backend to manage the contents. Besides just having the contents (webpages, images, docs, etc.), the website also has
APIs
also so that users can access contents through apis.Recently, when I checked Umbraco (after a break), I saw that REST APIs are discontinued for Umbraco Headless.
Here is what I would like to know:
Is it possible to create APIs in Umbraco that has endpoint -
/api/your_controller/method_name
instead of/umbraco/surface/your_controller/method_name
?Has anyone used APIs in Umbraco in format
/api/your_controller/method_name
? How was your experience? Is that like a cake-walk?Can someone please suggest which is best approach to take here? Should I rely of REST APIs (which is outside support cycle) or should choose Headless for api implementation.
Thanks in advance.
Hi Abilash,
It depends what you are trying to do. If you are still wanting to serve a full website as part of your Umbraco instance the Umbraco Headless offering might not be quite what you are after.
There is a new package/git repo that does something similar to what you are after so it might be worth having a look at it here: https://github.com/mattbrailsford/umbraco-headrest
Additionally, there is a GraphQL experimental git repo here: https://github.com/rasmusjp/umbraco-graphql (I know this isn't a REST implementation but thought I'd mention it)
Nik
Hi Abilash,
I have not had the opportunity to use Umbraco Rest APIs myself, but for the projects I have worked on so far, I used to write my own web API Controllers and action implementations to expose just the data I want to expose using the right Service (ContentService, MediaService etc)
https://our.umbraco.com/documentation/reference/routing/webapi/
Hello Bharani Dharan Jayasuri,
Thanks for the reply. By default, apis we create in Umbraco has format
/umbraco/api/controller/method
or/umbraco/surface/controller/method
.I am looking for apis in Umbraco whose route looks like
/api/controller/method
. Is it possible to get that route which is more generic and common, instead of having/umbraco
sticking to the api endpoint?Is that something your were able to achieve when you developed APIs in Umbraco?
Abilash,
You should be able to register custom Api routes like this,
I just checked it locally and I could hit a sample get action of an UmbracoApiController I wrote like this,
http://localhost:7130/api/customapiroute/getsomestring
That's great to hear. I'll give a spin.
Thanks for the help :)
is working on a reply...