Question:
How do I pass parameters to the Script API?
Answer:
For a single parameter you can pass the value as given in this example:
curl -v -X POST -u user:pass --header "Content-Type: text/plain" 'http://localhost:8081/service/rest/v1/script/myScript/run' -d 'false'
Multiple parameters can be passed as JSON. The following example uses a separate parameters file.
params.json:
{ "repoName":"snapshots",
"groupId":"ch.zkb.slk.cpe.cpesupport",
"artifactId":"cpesupport-ear"
}
Then the command would be similar to the following:
curl -v -X POST -u user:pass -X POST --header 'Content-Type: text/plain' https://localhost:8081/service/rest/v1/script/myScript/run -d @params.json
Reference:
https://help.sonatype.com/en/managing-and-running-scripts.html