Once installed on a system,
rest-client can be included in a Ruby script by adding
GET and PUT Settings¶
In order to execute the example just copy the script content into a
test.ruby file and execute the following command:
$ ruby test.ruby
This example shows how to read the settings using GET, make a change and then use PUT to write the change to the server.
require 'json' require 'rest-client' url = 'http://admin:geoserver@localhost:8080/geoserver/rest/' # get the settings and parse the JSON into a Hash json_text = RestClient.get(url + 'settings.json') settings = JSON.parse(json_text) # settings can be found with the appropriate keys global_settings = settings["global"] jai_settings = global_settings["jai"] # change a value jai_settings["allowInterpolation"] = true # put changes back to the server RestClient.put(url + 'settings, settings.to_json, :content_type => :json)