changing status code when it's not part of the result

General discussions related to APLNext's Application and Commerce WebServices and WebTransfer product.

Moderators: Tech Support, phpbb_admin

changing status code when it's not part of the result

Postby Chizever » February 4th, 2021, 4:46 pm


I have a virtual path which returns two results: content-type followed by document.
This allows me to return text/xml, text/html, or application/json as needed.

In all these cases the return status is 200 OK, I'm not returning either Status-code or Reason-phrase.

I now realize that I sometimes want to return a status of 401 Unauthorized.

Question 1: Is there a way to set the status code without changing my virtual path definition?
It would be a lot easier for me to do something like:
Code: Select all
'#' ⎕wi 'Notify' '<aplresult><aplmethod>Status-code</aplmethod><apldata>401</apldata></aplresult>'

when it's needed instead of changing the virtual path definition and having my functions return the status code (which is mostly 200).

Question 2:
If I change my virtual path result to include Status-code but not Reason-phrase, will the header show the correct reason?
Is the reason phrase only if I want to give my own message and not the standard one assigned to that status?

Posts: 84
Joined: March 1st, 2007, 12:12 pm

Re: changing status code when it's not part of the result

Postby Davin Church » February 4th, 2021, 7:05 pm

I've only ever had a virtual path definition that returned all the different items that I make use of, including status code, redirects, and cookies. I haven't seen any alternatives, but I'm still using a very old version.
Davin Church
Posts: 668
Joined: February 24th, 2007, 1:46 am

Return to APL WebServices

Who is online

Users browsing this forum: No registered users and 1 guest