ALM 11 – GETTING STARED WITH REST API
With the release of ALM 11, HP now offers an API that allows the user to interact with QC/ALM using REST. Rather than writing OTA code, one can now accomplish some of the same functionality using a browser as a client – no code writing needed.
Of course, you can also use tools like soapUI to work with ALM or create custom applications using languages like VBscript, C# and Java that interact with ALM.
But to keep it simple, we'll start by taking a look at how to get started using your browser as a client.
Getting started using your browser as a client
The first thing you'll need to do before using the ALM REST API is to authenticate your user. You can do this by obtaining a session cookie which returns a token that, by default, times out after one hour of inactivity.
Authenticate your user
1. Determine whether your user is currently authenticated by navigating to:
http://yourALMServer/qcbin/rest/is-authenticated
If your user is not currently authenticated, you'll get an HTTP Status Code 401.
2. To authenticate your user, navigate to:
http://yourALMServer/qcbin/rest/is-authenticated?login-form-required=y
3. Enter the ALM login name and password you want to authenticate:
4. If your ALM user is authenticated, you'll get the following XML:
How to READ an ALM defect
You should now be authenticated. Cool! Next, let's make sure we're able to retrieve the very first defect in ALM.
1. To READ an ALM defect record, place the following URL (using your ALM instance info) into your browser:
http://yourALM/qcbin/rest/domains/yourDomain/projects/yourProject/defects/1
2. The first defect should populate your browser with its XML info:
Although our example returned info for a defect in ALM, you can also read info for the other ALM entities, which are:
- Defects
- Resources
- Requirements
- Tests
- Test lab
For example – if we wanted to read the first requirement info from ALM, we would simply change the defect URL we used to point to requirements instead of defects:
http://yourALM/qcbin/rest/domains/yourDomain/projects/yourProject/requirements/1
Other common tasks you can perform
We saw in the example above how easy it is to READ an existing record in ALM. Some other common tasks that can be performed using the ALM API are:
- Create
- Delete
- Read
- Update
That should be enough info to get you started using the ALM REST API. For more info, be sure to check out HP's ALM REST API doc – and as always, drop me a line with any questions or comments!