I have a need to use the settings api to get the “sonar.webhooks.project” value, for a particular project. I then need to set that value into a different (but related) project.
I have no trouble getting the value.
If I had no restrictions, setting the value in the other project would also be simple. Unfortunately, the straightforward way to do this requires outputting JSON, and it looks like I’m not going to be allowed to do that in the normal way (I could simply hardcode a json string, but that’s not something I can live with). The issue is sandbox restrictions in the Jenkins pipeline script. All the paths that I’ve tried to take that require generating JSON from an object are either hitting script restrictions (which are not going to be approved), or just bugs in Jenkins pipeline steps (writeJSON throws known exception).
I’d really like to figure out how to use the “/settings/set” api in a way that doesn’t require using JSON. I had initially tried using the “fieldValues” parameter with JSON, but as I said, I have unreasonable obstacles down that path. I thought perhaps I could somehow use the “value” parameter instead, but the problem is the webhook value is a pair of values, a “Name” and “URL”.
Is there some way I can use the plain “value” parameter so I can set the webhook, without using JSON?