HP ALM REST API

This category is meant to hold all articles regarding HP ALM REST API.

Connecting to HP ALM via Java is a bit of a cumbersome task when you have never worked with a REST API before.

It is for certain not as easy as connecting to a database using a connector provided by any vendor.

Using the HP ALM REST API Examples in version 11.52

In order to use the HP ALM REST API Examples in Eclipse you will have to apply changes to some classes and even rewrite some of the tests.

I like to have simple examples, which are not hard to understand for beginners. In contrary HP provides you with an examples section, which is not easy to understand or use due to missing explanations as well as overall complexity.

First you should understand what is happening in the background when you will use the little API HP provided. The following article might help to give you an idea.

Connect to HP ALM via browser using REST API

Anyhow, let's start by setting up an example eclipse project.

Prepare HP ALM REST example project in eclipse

Create a new Java Project in eclipse called "almConnector" (or whatever you like - it does not matter).

In the src directory of this new eclipse project create three new packages.

  • alm
  • infrastructure
  • test

Now go to the HP ALM REST API reference in your ALM documentation library.

To do so when looged into a HP ALM project choose Help -> Documentation Library from the top menu bar.

Using the REST API it is possible to link a defect to another entity.

In this article I want to show how to link an existing defect to a requirement using XML.

Identify required fields

According to the REST API documentation a link is described by the entity "defect-link".

First we need to identify required fields for the entity "defect-link". To do so we have to call the following URL e.g. using your browser.

https://{HOST}/qcbin/rest/domains/{DOMAIN}/projects/{PROJECT}/customization/entities/defect-link/fields?required=true

Currently I am playing with the REST API of HP ALM and since some basics are always good before you start automating things, I first wanted to connect to ALM using a web browser.

Authentication

Open a browser and type in the following url, but replace the part {host} with the address to your HP ALM server.

https://{host}/qcbin/authentication-point/authenticate

This will display a simple login dialog, in which you provide your HP ALM user name and the corresponding password.