Query a Collection
Collections contain Instances. A collection is read with a GET operation. For example, the defects collection resource is at: http://{server:port}/qcbin/api/domains/{domain}/projects/{project}/defects
The returned data is paged. See Data Paging.
Data from the query is returned in the JSON format unless specified otherwise in the individual reference. You can specify a supported data format with an ACCEPT header .
A GET request that returns a large amount of data can stress the database server and cause performance degradation for all users. To minimize the load:
- filter the instances to be returned with a query clause. See query Clause: Restrict response by field values
- retrieve only the fields you actually need by using a fields clause. See fields clause
You can set the order in which resources are returned. See order-by clause: Sort results.
Get defects |
---|
*** Request *** GET http://my-server:8080/qcbin/api/domains/default/projects/REST/defects/ HTTP/1.1 Referer: http://my-server:8080/qcbin/doc/index2.html Accept: application/json Accept-Language: en-US Accept-Encoding: gzip, deflate User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0) Connection: Keep-Alive DNT: 1 Host: my-server:8080 Cookie: JSESSIONID=1234567890; hp_last_segment=segment neutral; s_vi=1234567890; hpeuck_answ=0; Remember_me=1234567890; s_fid=1234567890; _HPNNPERSIST=my-user@my.com; SMSESSION=1234567890; JSESSIONID=1234567890; hp_last_segment=segment neutral; s_vi=1234567890; hpeuck_answ=0; Remember_me=1234567890; s_fid=1234567890; _HPNNPERSIST=my-user@my.com; LWSSO_COOKIE_KEY=1234567890; QCSession=1234567890; ALM_USER=1234567890; XSRF-TOKEN=1234567890; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0) Connection: Keep-Alive DNT: 1 Host: my-server:8080 Cookie: JSESSIONID=1234567890; hp_last_segment=segment neutral; s_vi=1234567890; hpeuck_answ=0; Remember_me=1234567890; s_fid=1234567890; _HPNNPERSIST=my-user@my.com; SMSESSION=1234567890; JSESSIONID=1234567890; hp_last_segment=segment neutral; s_vi=1234567890; hpeuck_answ=0; Remember_me=1234567890; s_fid=1234567890; _HPNNPERSIST=my-user@my.com; LWSSO_COOKIE_KEY=1234567890; QCSession=1234567890; ALM_USER=1234567890; XSRF-TOKEN=1234567890 *** Response *** HTTP/1.1 200 OK Date: Mon, 22 Dec 2014 13:32:58 GMT Cache-Control: no-cache, max-age=0 Pragma: no-cache Content-Type: application/json Vary: Accept-Encoding, User-Agent Content-Length: 8505 Server: Jetty(9.1.3.v20140225) { "data": [ { "type": "defect", "has-change": null, "planned-closing-ver": null, "test-reference": null, "subject": null, "reproducible": null, "request-id": null, "request-server": null, "id": 2, "ver-stamp": 2, "has-others-linkage": "N", "description": "<html><body>\n<p>Were headed for Scotland, but went to London, instead.</p> \n</body></html>", "priority": "4-Very High", "name": "Lydia in London with Wickham", "has-linkage": "N", "run-reference": null, "cycle-reference": null, "dev-comments": null, "creation-time": "2014-12-23", "to-mail": null, "request-note": null, "closing-version": null, "cycle-id": null, "detection-version": null, "last-modified": "2014-12-23 14:16:33", "status": "New", "closing-date": null, "detected-in-rcyc": null, "detected-in-rel": null, "severity": "5-Urgent", "attachment": null, "extended-reference": null, "estimated-fix-time": null, "project": null, "target-rel": null, "detected-by": "darcy", "environment": null, "step-reference": null, "owner": "steves", "target-rcyc": null, "actual-fix-time": null, "request-type": null }, { "type": "defect", "has-change": null, "planned-closing-ver": null, "test-reference": null, "subject": null, "reproducible": null, "request-id": null, "request-server": null, "id": 3, ... }, { "type": "defect", "has-change": null, "planned-closing-ver": null, "test-reference": null, "subject": null, "reproducible": null, "request-id": null, "request-server": null, "id": 4, ... }, { "type": "defect", "has-change": null, "planned-closing-ver": null, "test-reference": null, "subject": null, "reproducible": null, "request-id": null, "request-server": null, "id": 6, ... } ] } |