· Mar 27

Returning a 401 using %REST.Impl


I am trying to convert some old rest classes using the OpenApi spec (e.g. %REST.Impl)

Say I want to return a 401 in my impl.cls for api and I can define the status code as follows, e.g.

 Do ..%SetStatusCode("401")
 Do ..%SetContentType("application/json")

However the api client will see this as 401 OK which is not right.

In the past, I could just create a rest class that extends from %CSP.REST and return as follows:

Set %response.Status = ..#HTTP401UNAUTHORIZED

This will return 401 Unauthorized, which what I expect to see reported in the api client.

How this possible to achieve the same behaviour %REST.Impl? I can't see a method that supports this.



Product version: IRIS 2023.1
$ZV: IRIS for Windows (x86-64) 2023.1.3 (Build 517U) Wed Jan 10 2024 13:36:58 EST
Discussion (3)2
Log in or sign up to continue