Jenkins : Add a Maven Installation, Tool Installation, Modify System Config

Jenkins system configuration is not available via REST endpoints, this is a snippet to modify it:

a=Jenkins.instance.getExtensionList(hudson.tasks.Maven.DescriptorImpl.class)[0];
b=(a.installations as List);
b.add(new hudson.tasks.Maven.MavenInstallation("MAVEN3", "/home/apache-maven-3", []));
a.installations=b
a.save()