Search code examples
javahp-alm

How to create new defect/s in HP ALM 12 using REST


I am working on a Java application to connect with HP ALM 12 using their REST API programmatically and have been hitting some road blocks as they don't seem to provide any examples for that in their documentation, unless I am looking at the wrong place.

So far, I have been able to do the following:

  • Authenticate a user
  • Get a list of all existing entities, defects

Has anyone been able to do the following

  • Get a list of fields (for any new defect) in any particular release
  • Determine if those fields are required (mandatory) or not
  • Then based on that create a new defect and save that defect in ALM using the REST API ?
  • Get a confirmation for the created defect, such as a Defect ID.

Any example or suggestions are welcome.


Solution

  • After some digging through their documentation, I figured out the schema elements for the defect type and all its dependencies. I then generated JAXB classes out of them using Java's xjc utility. Then used it to marshall an XML that I was able to insert in ALM 12 with no issues. There, however, seem to be certain fields within ALM 12 that need special attention (i.e, DetectedInRelease etc) that store an internal folder structure instead of a straight value. Other than that, it seemed straightforward. I will try to write up a blog article with sample code as soon as I find some free time.

    Meanwhile, if anyone has specific questions about the process, please post them here and I will try to answer them to the best of my knowledge.