How do api controllers in the App_Plugins directory get routed?
Hi Guys,
I'm relatively new to Umbraco (working with V7) and I'm currently extending the backend, creating a custom Image Gallery plugin. As part of this process, I'm writing a custom property editor. All of the files are hosted in the App_Plugins directory. My project includes an API Controller that I also wish to host in the App_Plugins directoty.
My problem is that I cannot find out how the API Controller is routed or whether I need to manually route it myself. The API controller is called ImageGalleryApiController.cs and it sits in a plugin folder called ImageGallery which sits under the App_Plugins folder.
Does anyone know how I can find the URL of my API controller, I have tried various things such as:
but neither of these URLs works. I can get it to work if I put the Api Controller in a controllers directory in root of the Umbraco directory tree as indicated by various API controller tutorials, but I want to host my API controller in the App_Plugins folder so I can keep everything together.
I've done various Google searches and apart from a few suggestions that haven't worked, I haven't turned up anything useful.
Typically I've just found the answer. For those who also woudl like to know, you basically need to decorate your controller the PluginController attribute to give you something like the following:
[PluginController("ImageGallery")]
public class ImageGalleryApiController : UmbracoApiController { ....
How do api controllers in the App_Plugins directory get routed?
Hi Guys,
I'm relatively new to Umbraco (working with V7) and I'm currently extending the backend, creating a custom Image Gallery plugin. As part of this process, I'm writing a custom property editor. All of the files are hosted in the App_Plugins directory. My project includes an API Controller that I also wish to host in the App_Plugins directoty.
My problem is that I cannot find out how the API Controller is routed or whether I need to manually route it myself. The API controller is called ImageGalleryApiController.cs and it sits in a plugin folder called ImageGallery which sits under the App_Plugins folder.
Does anyone know how I can find the URL of my API controller, I have tried various things such as:
http://localhost:500/App_plugins/ImageGallery/imagegalleryapi/getimages?GalleryID=l
and
http://localhost:500/umbraco/App_plugins/ImageGallery/imagegalleryapi/getimages?GalleryID=l
but neither of these URLs works. I can get it to work if I put the Api Controller in a controllers directory in root of the Umbraco directory tree as indicated by various API controller tutorials, but I want to host my API controller in the App_Plugins folder so I can keep everything together.
I've done various Google searches and apart from a few suggestions that haven't worked, I haven't turned up anything useful.
I'm sure this must be possible.
Thanks,
Damien.
Typically I've just found the answer. For those who also woudl like to know, you basically need to decorate your controller the PluginController attribute to give you something like the following:
[PluginController("ImageGallery")]
public class ImageGalleryApiController : UmbracoApiController
{ ....
The above will cause it to routed to:
http://yoursite.co.uk/umbraco/ImageGallery/ImageGalleryApi/GetImages - assumning you had a parameterless method called GetImages
Hope this helps others with a similar question.
Cheers,
Damien
is working on a reply...