To perform a Repository Query Language (RQL) query, send a REST Web Services request as described in the following table. See information about repository queries in ATG Repository Guide.
Request Component | Value |
---|---|
HTTP Method | GET |
Functional Parameters | Include the If you include this parameter as a URL query string, make sure that you URL encode the RQL query. For example, the query |
URL | Include the component pathname of the repository item type that you want to query in the application path after |
The following example shows a REST Web Services request that performs an RQL query. It returns the first four items of item type product
in the /atg/commerce/catalog/ProductCatalog
repository.
curl -v -b cookies.txt -X GET \ http://myserver:8080/rest/repository/atg/commerce/catalog/ProductCatalog/product?atg-rest-rql=ALL+RANGE+%2B4 * About to connect() to myserver port 8080 (#0) * Trying 12.34.567.890... connected * Connected to myserver (12.34.567.890) port 8080 (#0) > GET /rest/repository/atg/commerce/catalog/ProductCatalog/product?atg-rest-rql=ALL+RANGE+%2B4 HTTP/1.1 > User-Agent: curl/7.21.1 (i386-pc-win32) libcurl/7.21.1 zlib/1.2.5 > Host: myserver:8080 > Accept: */* > Cookie: DYN_USER_ID=140003; JSESSIONID=0D62D5F5145D6A1E7A2EDBC669F3BA0F; DYN_USER_CONFIRM=1231cf3e7573bf936dbd29dbbbfe150b > < HTTP/1.1 200 OK < Server: Apache-Coyote/1.1 < X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1 < X-ATG-Version: version=QVRHUGxhdGZvcm0vMTAuMCxDb21tZXJjZVJlZmVyZW5jZVN0b3JlLzEwLjAgWyBQbGF0Zm9ybU xpY2Vuc2UvMCBCMkNMaWNlbnNlLzAgIF0= < Content-Type: application/xml;charset=UTF-8 < Transfer-Encoding: chunked < Date: Fri, 29 Oct 2010 21:33:00 GMT < <?xml version="1.0" encoding="UTF-8"?> <atgResponse> <product> <element>http://myserver:8080/rest/repository/atg/commerce/catalog/ProductCatalog/product/xprod2022</element> <element>http://myserver:8080/rest/repository/atg/commerce/catalog/ProductCatalog/product/xprod1064</element> <element>http://myserver:8080/rest/repository/atg/commerce/catalog/ProductCatalog/product/xprod2024</element> <element>http://myserver:8080/rest/repository/atg/commerce/catalog/ProductCatalog/product/xprod1066</element> </product> </atgResponse> * Connection #0 to host myserver left intact * Closing connection #0
Note: You can include the atg-rest-rql
functional parameter in the message body of a POST HTTP request if you prefer not to URL encode your RQL queries. Use the atg-rest-view
control parameter to instruct the REST Web Services server to handle your POST request as a GET request. See Handling POST Requests as Other Methods.
Note: Do not include parameters in the RQL queries that you perform via the REST Web Services. Make sure that all constants are explicitly included in the RQL statements. See information about parameters in RQL queries in the ATG Repository Guide.