In other part of code, how is the service or other methods, to call this action that have this url: "Umbraco/Api/BlogComments/GetComments" and return a list of comments?
I'll try to rephrase the question.
I created a custom "controller" which has an Action that fetches data from a custom table. I tested the url with Postman and the call works returning a list of elements in json format... Now unlike SurfaceController where I always used "BeginUmbracoForm" to make the call to the controller, how do I make a call to a Controller API with Umbraco? What is the service/interface that provides a method that takes the url as parameter and can I get a list of elements as a result?
Call action in custon Api Controller
Hello everyone, i need to know how call an action in custom Api Controller. For exemple in this official guide there is a controller called: "BlogsCommentController". Have an action "GetComments"... https://docs.umbraco.com/umbraco-cms/tutorials/getting-started-with-entity-framework-core
In other part of code, how is the service or other methods, to call this action that have this url: "Umbraco/Api/BlogComments/GetComments" and return a list of comments?
Thanks in advance.
I'm not sure exactly what you are asking
I would like to know how to make a call to a controller (Api Controller), more precisely its action to return the requested values.
I'll try to rephrase the question. I created a custom "controller" which has an Action that fetches data from a custom table. I tested the url with Postman and the call works returning a list of elements in json format... Now unlike SurfaceController where I always used "BeginUmbracoForm" to make the call to the controller, how do I make a call to a Controller API with Umbraco? What is the service/interface that provides a method that takes the url as parameter and can I get a list of elements as a result?
I think you need to call the api from C# code. There is not a default way from umbraco to call an API from razor views.
if in a view you would need to use javascript to execute the api method
Thank you very much @JohanReitsma.
is working on a reply...