How to execute scriptler script in jenkins remotely / via REST API?

424 views Asked by At

In Jenkins, I would like to execute my scriptler script via REST API from bash and curl. According to documentation it should work, but there isn't any working example.

I have created simple script testScr, which is just one liner: println "OK". I'm trying to execute it with curl:

curl -d '{}' --user <userid>:<Token> http://<jenkins_server>/scriptler/run/testScr > result.html

Resulting html says: "Oops! A problem occurred while processing the request."

How to do it correctly? Is even it working for somebody?

1

There are 1 answers

0
Jheison Rodriguez On

Yes that works for me. Have you made sure that the user have the right permission and the token is corrct?

In my case I'm using Role-based Authorization Strategy

And you can execute it if you're admin

enter image description here

if you want another user different that admin execute it you can also grant permissions

enter image description here