Search code examples
phprestalmhp-quality-centerhp-alm

Get subfolders name from folder name in Test labs using HP ALM REST API


I am using HP ALM rest API to access HP QC data. How to get subfolders name from parent folder name in Test Lab using HP ALM REST API

I have used this link for LOGIN TO QC REST.

GET DATA FOR SPECIFIC FOLDER:

http://IP:PORT/qcbin/rest/domains/MYDOMAIN/projects/MYPROJECT/test-set-folders?query={name['MYFOLDER']}

Now I want list of subfolders name under 'MYFOLDER'


Solution

  • That's quite obvious...after you sent the first REST message;

    GET http://IP:PORT/qcbin/rest/domains/MYDOMAIN/projects/MYPROJECT/test-set-folders?query={name['MYFOLDER']}
    

    you will get an xml back --> look at the ID for that folder (this is unique in QC). Next query will be:

    GET http://IP:PORT/qcbin/rest/domains/MYDOMAIN/projects/MYPROJECT/test-set-folders?query={parent-id[ID_found_in_previous_step]}
    

    This will give you an xml with all the subfolders part of the initial folder :-)

    I hope this is clear enough to solve your query! Have a nice day.