Rule DSL and REST Api sendHttpGetRequest - authentication?

Hi,
i’m trying to access the rest api from a DSL script. e.g.
sendHttpGetRequest("http://127.0.0.1:8080/rest/links")
however, this fails because (apparently) the rule engine isn’t authorized to access the rest api.
HTTP protocol violation: Authentication challenge without WWW-Authenticate header
I tried adding login/pass in the url, but to no avail
sendHttpGetRequest("http://<login>:<password>@127.0.0.1:8080/rest/links")

any ideas?
thanks.

Search the forum? You can turn on Basuc Auth and put the username & password in the hearer or generate an API token from the Admin page to use.

There are examples here.

thanks for the quick reply,
I did search for that, but didn’t find an example how to manipulate the header with the rule DSL.
sorry, if i missed it, maybe you can point me to a DSL example that does that?

Hang on, I didn’t know about the need settings->systemservices->apisecurity->allowbasicauthentication

toggling that to ON did the trick! thanks!

1 Like

Glad you found it. IMO the documentation is fragmented right now.