The short answer is you can't, not with REST API.
Now with Java API, you could, that is if you have a plugin allowing you to run groovy scripts on your instance?
In any case I do not think this would be even remotely a common use case, and probably does not get automated a lot, if at all - project configuration should (at least in my opinion) be mostly constant. I'm not sure why you are trying to automate it, but there probably could be a better way so that your configs do not end up changing several times a day.
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events