1

I have the following API controller in Umbraco:

public class DocumentTypeController : UmbracoAuthorizedApiController
{
    private IServices services;

    public DocumentTypeController(IServices services)
    {
        this.services = services;
    }

    // GET: DocumentType
    [HttpGet]
    [Route("api/documenttype/all")]
    public JsonResult<List<DocumentTypeModel>> GetAll()
    {
        var documentTypes = this.services.DocumentTypeService.GetAll();
        return Json(documentTypes);
    }
}

I'm making a call to this controller using the custom route defined on the method... however it's throwing a 404.

Is there anything special i need to do for it to register the custom route attribute defined?

My Angular plugin code is calling like this:

    $http.get("http://localhost:55262/api/documenttype/all").success(function (data) {                 
        deferred.resolve(data);
    });
Jimmyt1988
  • 20,466
  • 41
  • 133
  • 233
  • When you type `http://localhost:55262/api/documenttype/all` in your browser what do you see? Is it 404? – Kosala W Dec 09 '15 at 00:42
  • I am not sure if you can override the Umbraco Web API controller like this, since all the actions are going through: `/umbraco/backoffice/api/{controller}/{action}`. On the other hand, if I am wrong and this is possible, have you enabled attribute routing in `RouteConfig` like this: `routes.MapMvcAttributeRoutes();`? – Marko Jovanov Dec 09 '15 at 08:31

0 Answers0