I am trying to simplify my API experience (if possible) since I am not a developer. Software called “postman” is one of the ways to do it and I am wondering if there is a downloadable prepared object package for postman? Otherwise I have to write API calls and of course save them for later use, but if someone already did it I can just make an import into postman.
Or if somebody has any other suggestion besides postman…?
I also use Postman for my developing tasks but unfortunately I haven’t used it with OpenNebula’s API so I can’t provide you any helping object . What language are you using other than Java and Ruby?
That’s a good one.
I am not using any language since I am a network and data center engineer. Just this year I started to venture into cloud and software defined networking. The last time I used a programming language was some 15 years ago and that was not too advanced.
I wanted to use Postman to be able to make test API calls, check the format, check the results etc. without too much hassle. I have no develeper environment whatsoever.
OK, I will craft API calls manually. Fine. But do you have some examples? Going through documentation I was only able to find some bits and pieces, but not a single full example, not even for the simplest call (to get “onevm list” for instance).
I’ll check if I can do a ‘onevm list’ using Postman give me some time though
what an attitude man, kudos…
Ok Bojan!, this is what I’ve tested so far.
I’ve installed this Chrome extension (chrome-extension://mbelaappiaalhoceejaopcghdlnhhain/main.html) which is an XML-RPC client. I’ve entered my OpenNebula testing URL endpoint: http://192.168.121.123:2633/RPC2
Then I’ve clicked on Get methods and… every method listed in the docs are there automagically: http://docs.opennebula.org/5.2/integration/system_interfaces/api.html
So I’ve tried to get the info for a VM with ID = 1. I’ve selected the one.vm.info method which requires two parameters IN according to docs the session string (you can use the content of the /var/lib/one/.one/one_auth file) and the ID of the VM so you have to set those IN parameters in a JSON array in this example: [“oneadmin:opennebula”,1] oneadmin:opennebula is the content of the one_auth file. OK I click on send and it works!
Al those CDATA and < and > are part of the xml response with comes as a string.
I’ve done the same thing with POSTMAN but it’s a little harder:
I’ve tried to run the one.vmpool.info which provides the onevm list… in XML-RPC client I’ve tried to use the following array [“oneadmin:opennebula”, -2,-1,-1,-1] according to the docs and I think it dumps all the info about VMs:
So next step would be how to parse all that data, so I guess now that a programming language would be helpful to parse the answer and all that stuff!
I’ve found this URL quite interesting to understand how I should prepare the POSTMAN parameters (http://xmlrpc.scripting.com/spec.html)
Thanks a lot for all of this. Based on your post I managed to get a hold on these tools and start working on my own.
What I find strange is the response format. To me it is really strange that it comes out just like a bulky bunch of data. This would mean that any software that talks through API should first implement an advanced parsing scheme. I am not a developer, maybe this is the norm but…??
I hope someone from OpenNebula will comment on this.
One more thing. Besides chrome xml-rpc client I have found an add-on for firefox. It is “RESTClient” which you can use in the same way.
Also, that chrome extension has a nice feature “get methods” which other solutions do not have. I managed to get the same result with this POST request:
Probably xml-rpc client is using just that.
and it’s nice to have more tools like the one you’ve mentioned in Firefox. I’ll have a look on how to parse the response as soon as I can.