In this step we want to get a first WebApi Controller to work.
We'll start with the Insights Controller since it's fairly simple and doesn't any UIs.
- Define the path where APIs will be published. In general we need some kind of root path, after which all 2sxc endpoints are added. Common roots are
/api/sxc/
, [some-root]/api/sxc/
or similar.
- Determine where you'll store all your web-api files. In the end there will be about 30 in various folders, so let's assume you'll call it
Controllers
.
- In your location create a
Sys
folder.
- Create a Web-API Controller in the technology that you're using - usually called
InsightsController
. Define the route
- Now create a simple Ping-action just to see it work. If all worked, you should be calling something like
/api/sys/insights/ping
and getting a result.
- Now continue to creating the entire insights controller. If you have a proper DI-system which initializes the controllers, use the examples from ToSic.Sxc.Oqt. If you don't, use the DNN examples.
If you have the insights, can start with /api/sxc/insights/help and navigate around in the memory, then you have your first controller working!