how to relate(relation) automate run test with defect using REST API

i want to link the automated run failed with new defect using REST API. Is there any API for relation?

I found below API.

https://octane.abc.com/api/shared_spaces/<space-id>/workspaces/<workspace-id>/defects

https://octane.abc.com/api/shared_spaces/<space-id>/workspaces/<workspace-id>/tests

Attached: In ALM Octane > Defect > Relation - show automated run link with defect.

 

Regards

Adilla

  • Hi Adilla,

    I assume you can use the entity run_automated and set the field defect to link the specific run to an existing defect. Actually I didn't try this specific relation but I've linked e.g. requirements to tests and defects in the GDPR Content Pack. You can download it at https://marketplace.microfocus.com/appdelivery/content/gdpr-content-pack and review the code at module modOctane / sub subOCTCreateRelation.

    The Content Pack also has a quite useful feature for developers using the Octane REST API: You can easily pull all Octane entities and their fields from your Octane environment (the REST API is enhanced in every new version). For example run_automated on my Octane environment has 78 (!) fields, this screenshot shows only a few of them:

    run_automated.PNG

     Hope this helps?

    Regards,

    Dirk

     

  • On defect you have `run` field.
    When creating new defect you can set this field to reference the run for which you are creating the defect, or alternativelly update existing defect to reference the run.

  • Verified Answer

    thank you All for reply my question.

    I already get answer from here and the rest API required is below:

     

    https://octane.abc.com/api/shared_spaces/<space-id>/workspaces/<workspace-id>/work_items?reference_update_mode=append

     

    body content - contain run id(39056) & defect id(43001) :

    {"data":[{"run":{"data":[{"type":"run","id":"39056"}]},"id":"43001"}]}

     

    if get error 405 - Method Not Allowed, please insert below variable & values in header content:

    • variable: HPECLIENTTYPE
    • value: HPE_REST_API_TECH_PREVIEW