404 Error using REST - Difference between local and cloud

1
Hi there, I am using (Mendix native) REST api's to expose all kinds of data. For example lists of invoices: localhost:8080/api/customers/{customerId}/invoices. I've added custom error handling to return a 404 when the customer cannot be found in the database: 404 Not found { "errorCode": "404 Not found", "errorMessage": "Customer with erp id: 1000 not found" } When I do the exact same call to my Mendix cloud environment (https://myapp-accp.mendixcloud.com/api/customers/1000/invoices), this is the response: 404 not found <html> <head> <title>404 Not Found</title> </head> <body bgcolor="white"> <center> <h1>404 Not Found</h1> </center> <hr> <center>nginx</center> </body> </html> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> How can I solve this? I would really like to give the user of my api the proper response (the response I get locally). Thanks for your help!    
asked
3 answers
3

Hi, This is a bug. I've made a ticket a while ago. Seems that when returning a 404, you'll get the HTML page (instead of your onw 404 respone). Mendix is working on it. For the time being, we use a 422 response, that one will work just fine.

 

Sven.

answered
1

Maybe this blog post will help you: https://www.linkedin.com/pulse/how-make-most-out-mendix-native-rest-publish-willem-van-zantvoort/

Regards,

Ronald

 

answered
1

Hi Tim,

Did you check the path restrictions

-Andrej

answered