Search code examples
web-servicesrestosgilotus-domino

How can I override the standard Domino error page for a REST webservice?


I have a webservice (OSGi application) which on failure returns the error as HTML, which seems to be the Domino standard.

enter image description here

I know I can use the error codes provided, but would like to return a JSON formatted error instead.

Anyone who knows how to?

Ove


Solution

  • To handle the 401 response in the REST Service database you need to allow the Anonymous users to access the REST service and then in the REST Service respond if the user is Anonymous. This can be done without opening the database to significant access by Anonymous users by keeping the ACL for Anonymous at No Access BUT allowing it to Read Public Documents. Then your XPage that contains the REST service is flagged as Available for Public Access users.