- This topic has 1 reply, 2 voices, and was last updated 6 years, 6 months ago by .
Viewing 1 reply thread
Viewing 1 reply thread
- You must be logged in to reply to this topic.
Hi,
I would like to return a different http statuscode when a wrong parameter is passed to a REST method. If I am not mistaken an internal server error occurs by default. I know I can use:
kbmMWRaiseHTTPError(407,’….’) or
raise EkbmMWHTTPException.Create(407,’…’);
But how do I know that the (rest body) parameter is wrong?
Thank in advance
Luigi
If its data extracted from the URL path part {..} syntax, or data extracted from the query part $… syntax, then just define the arguments to be required in the arguments REST attribute [kbmMW_Rest(‘value:”{value2}”, required:true’)]
If its data attempted to be extracted from the body part, then all you refer to is [kbmMW_Rest(‘value:body’)]’. A body may or may not contain anything. You however later on use TkbmMWHTTPQueryValues to extract the body parts.