There are two cases:
In the first case, set a break point, see why a 404 error is returned.
In the second case, set the REST Publish log node to Trace and see why Mendix decides to return a 404 error. You can also reference the REST routing documentation.