Using Ruby to create and transition assembly
Now that we know the basics of the REST API and know how to access it via the command line, we can start writing scripts to do various things. Our goal is to create an assembly, add some platforms to it, and transition it, all through a script. So, let's start with a simple script and see if we can build on top of it. We start by porting what we did from the command line to a Ruby script, accessing our organization. Our script looks something like this:
require 'rest-client' require 'json' token = 'CMS8qQDddG1AZxazkTz5' server = 'http://localhost:9090' client = RestClient::Resource.new(server,token,'') result = client['/account/organizations'].get puts result
If you save the script and run it, you can see the output also as given later. Of course, you will have to substitute the token and server with your own values.
As you can see, the output is as expected. Now let's modify...