This my CustomServices class where I added one custom Route.
- Code: Select all
#region Service
public class CustomServices : Service
{
[Authenticate]
public string POST(TestRequest request)
{
return request.Name;
}
}
#endregion
Here I am registering the route and the service
- Code: Select all
#region Registry
public class RESTAPIPlugin : System.MarshalByRefObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaRESTAPIPlugin
{
public void Configure(JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin, ServiceStack.ServiceStackHost AppHost, Funq.Container Container, JiwaFinancials.Jiwa.JiwaApplication.Manager JiwaApplicationManager)
{
AppHost.RegisterService<CustomServices>();
AppHost.Routes.Add(typeof(TestRequest), "/TestApi/TestEndpoint", "POST", "demo test endpoint", "");
}
}
#endregion
This the request Object
- Code: Select all
#region request
[Serializable()]
[ApiResponse(200, "Contacts read OK")]
[ApiResponse(401, "Not authenticated")]
[ApiResponse(404, "Not found")]
public class TestRequest : IReturn<string>
{
public int Id { get; set; }
public string Name { get; set; }
}
#endregion
Seems all steps are fine. What I missed here? Why I am getting 404 error?
I am using postman for testing the route.
My route URL looks like
http://localhost:8080/TestApi/TestEndpo ... AkFkasdfAK