I'm trying to create some web APIs in a new class library outside of my main website project (still in the same solution). In this library I've added the following API Controller:
namespace My.Custom.Namespace
{
[ServicesController("mycustomnamespace.customapi")]
public class CustomApi : ServicesApiController
{
public HttpResponseMessage TestMethod()
{
return Request.CreateResponse(HttpStatusCode.Accepted);
}
}
}
I then add this class library as a reference to my main website project, and try to call the API on this URL:
http://localhost/sitecore/api/ssc/mycustomnamespace/customapi/1/TestMethod
But I'm only receiving a 404: No HTTP resource was found that matches the request URI
How can I get a ServicesApiController
to work from a referenced project/DLL?
Sitecore 8.2 Update 5
/sitecore/api/ssc/{namespace}/{controller}/{id}/{action}
according to agehrke.com/2015/08/web-api-controller-in-sitecore-8 I've created and called WebAPIs like this, including the id parameter, from the website project successfully before, but when I follow the same procedure (basically the code in my question) while having the WebAPI in a referenced project/DLL, it doesn't work any more.CustomApiController
, and everything started working just fine. Thanks for the point in the right direction, and feel free to add this as an answer and I'll accept it.