Ah! my journey of exploring OpenShift platform went to next level today where I was kind of reading through the OpenShift REST API documentation, I can’t resist my temptation to try out various REST API calls. This lead to me to start exploring various tools preferably a graphical UI that could help doing various OpenShift REST API calls to to analyse and see how the messages are exchanged. My old friend soapUI came to my rescue, I am very comfortable using soapUI which from my experience the best tool that could be used to test web services, but then I have no experience of using it to test REST API with it but after this exercise I found that its no different from test webservices except that I need to make few additional steps to make it work.
In this blog, I am will show how we can use soapUI to test the OpenShift REST API , I will using my own PaaS which I have built as my server for REST API, if you have not set up your own PaaS please sure to check my blog on how to do it, nevertheless it is not a constraint you can use your OpenShift account too to test it out. If you have not downloaded the soapUI yet you can do it from here, once you have set that up we are good to go.
1. From the soapUI, create a new Project
2. Add REST service, this step will not add any REST resource but setup few things like the base REST URL for OpenShift API which is https://openshift.redhat.com/broker/rest
Before we do any action with OpenShift REST API, we need to understand what the API resources are available for us to work with, you can refer to the official documentation here, but the following steps shows you how to do that from soapUI
3. Now lets us add the entry point API REST URL to our project, this will help us to know, what are the various Resources that are provided by the OpenShift API and their functionalities., the entry point API URL is https://openshift.redhat.com/broker/rest/api. Right click your REST Service “OpenShift Broker” and select “New REST resource“, lets give Resource Name as “API Entry Point” and for the “Resource Path/Endpoint” we will provide “api“, we are providing only the last path of the URL mentioned above because we had set up the base path in previous steps.
4. Once you enter the information above and click OK it will then ask you for the New REST method details, we will have the method name as “API_ENTRY_POINT_RESOURCES” with HTTP method as “GET” and click OK
Now you will be shown with a window from where we can send in Request/Response for our API calls, just be sure to fill in the “Accept” drop down with the “application/json“, it could be “application/xml” but for this blog I will stick with “application/json”
Now we are all set to fire the REST call and receive the response, click the green button on the top left corner of the Request window, now you should see the response on the right side pane of the same window in XML format by default,
That’s all you need to get started with OpenShift REST API using soapUI, In the next part of this series we shall see how to we can play with other methods like add domain, application , pass credentials etc., until then happy hacking with OpenShift from Red Hat 🙂