RESTful web service request headers

Hi,

Is there any way to access the headers from the request in a Servoy RESTful web service. The client will send an API token as a header but I cannot see any way to get the value of this token in the ws_xxxx routines. Is this possible?

Thanks
Steve

Hi Steve,

Although I never used it (I always use the velocity plugin for my API’s), I guess it should be possible.

The plugin has a getRequest() function which returns the current running request.

So, this should return you the Authorization header:

plugins.rest_ws.getRequest().getHeader('Authorization')

Hope this helps

Marc you are a star! Just tried it and it works exactly as I want. I can access any of the headers using plugins.rest_ws.getRequest().getHeader(“KeyName”)

I had completely missed the fact that there was a rest_ws plugin and this is not mentioned at all on the Servoy Wiki for RESTful services.

If you are at ServoyWorld this year then I owe you a beer.

Thanks
Steve

Steve,

There was a inconspicuous link in the docs to the client plugin.
I have added a section to describe the client side a bit more explicit.

See https://wiki.servoy.com/display/DOCS/RE … b+Services

Rob

steve1376656734:
If you are at ServoyWorld this year

It’s al booked, see you there :wink: