On 22.5.2023 9.37, Greg Haverkamp via radiator wrote:
I'm attempting to call a fairly simple (but non-modifiable) restful
API by means of AuthBy REST, and I cannot seem to make sense of how I
should act upon the response it gives.
I get a JSON response that looks something like this:
{
"version": "LinOTP 2.11.2",
"jsonrpc": "2.0802",
"result": {
"status": true,
"value": false
},
"id": 0
}
I can create an example of how to access the contents of the "result"
key. The default is to create a Perl hash for the keys but more complex
structures require more configuration.
I've also been trying MapResponseHook, but the documentation on that
is, shall we say, spartan. I just figured it might get the server
response into a place where I could access it via AuthBy internal or a
post auth hook, maybe that's what's required.
Does someone have an example of how to use this with JSON going back
in response?
The MapResponseHook would be the tool here, and as you kindly put it, it
needs a better example of how to process responses like the one above. I
think there are at least two options here: use "status" and/or "value"
directly to trigger a reject or reply, or then save their values so that
they can be processed later. For example, for a hook or another AuthBy
you've mentioned above.
I'll get back to this.
Heikki
_______________________________________________
radiator mailing list
radiator@lists.open.com.au
https://lists.open.com.au/mailman/listinfo/radiator