I’ve got some code to consume REST in E10(thanks @josecgomez for all your help ), and everything is working, although I’m a bit unsure how to handle errors. In SOAP in E9 I used a try catch block to catch / handle errors… Although I don’t know what an error would look like in E10 REST, so I intentionally entered an invalid username/password for E10 to create an error, and I was surprised the response was an HTML webpage telling me I had an error(nice user interface for a person, but not so nice for an API…?). I’m thinking if the “value” field isn’t set I could assume I must have gotten an error. Maye there is a parameter I can pass to the API saying I’m not a user/browser give me errors back in the JSON not a nice user interface for a person? Any suggestions?
You could enable customErrors in your web.config and show a user friendly error perhaps
The HTML status code will tell you if you get an error (200 is OK, 4XX are errors, etc).
If you looking for developer logging/tracing, theres some suggestions here: ASP.NET Error Handling | Microsoft Learn
What Erp version is this?
We have json errors for at least couple of years
I agree with Olga. I misread maybe your post.
If you are getting a nice HTML Page with an error stating something like “contact your system administrator” and not an exception or a JSON Response for API Calls then you have to go to your web.config and simply add
<customErrors mode="Off"/>
There should be JSON. I received JSON responses in 10.1.600, 10.2.200, 10.2.300. It seems to be by default in 10.2 for me, but in 10.1.600 I had to add it the customErrors node to the web.config.