This GIST shows example on how to authenticate with HP/HPE/Microfocus ALM REST API and run queries.
Note:
By default, the ALM REST API returns XML data. If you want to get JSON data, add -H "Accept: application/json"
curl -X POST -H "Content-Type: text/xml" --cookie cookies.txt -k --cookie-jar cookies.txt -d "alm_useralm_password" https://alm_host:8443/qcbin/authentication-point/alm-authenticate
curl --cookie cookies.txt --cookie-jar cookies.txt --user alm_user:alm_password https://alm_host:8443/qcbin/authentication-point/authenticate
curl -X POST --cookie cookies.txt --cookie-jar cookies.txt https://alm_host:8443/qcbin/rest/site-session
curl --cookie cookies.txt --cookie-jar cookies.txt -g "https://alm_host:8443/qcbin/rest/domains/[ALM_DOMAIN]/projects/[ALM_PROJECT]/defects?fields=id,name,status,severity,owner&query={owner['alm_user']}"
curl --cookie cookies.txt --cookie-jar cookies.txt -g "https://alm_host:8443/qcbin/rest/domains/IT/projects/WORKSPACE_2/defects?fields=id,name,status,severity,owner&query={user-template-35['205713*'];status[Not%20Closed]}"
curl --cookie cookies.txt --cookie-jar cookies.txt -g "https://alm_host:8443/qcbin/rest/domains/IT/projects/WORKSPACE_2/defects/14729"
Logout when you are done (or keep re-using the cookie and disconnect only at the end of the session)
curl --cookie cookies.txt -k --cookie-jar cookies.txt https://alm_host:8443/qcbin/authentication-point/logout