Child pages
  • GetSavedQuery
Skip to end of metadata
Go to start of metadata


The GetSavedQuery API allows the Account Owner to retrieve a previously saved Query.


In apstrata, Documents that are saved in a Store can be retrieved by running a Dynamic Query or a Saved Query.

A Dynamic Query is one that is built every time on the fly by specifying the condition, fields to return, sort order, and aggregates.

A Saved Query is one whose definition is saved for later use. Rather than every time specifying the condition, fields to return, sort order, and aggregates, a developer can add a Saved Query whose definition specifies all the previously mentioned query constructs. Each Saved Query has a name which is used to run the Query and get back the results.

Moreover, a developer can implement a pagination model for the matching results by specifying the number of Documents per page as well as the number of the page to return. This is very useful for cases where a huge number of Documents matches the Query condition. In these cases, the results will be returned in pages or chunks rather than a whole block which impacts the performance of the application at hand.

Furthermore, when running a Query, a developer can look for documents matching a specific full text search criteria. In this case, documents satisfying both the Query condition and the full text search criteria will be returned in the results.

In terms of security, Documents or fields within a Document are returned in the results only if their read ACL contains the User or one of the Groups of the User running the Query

A developer may run as many Queries as needed per store. However, based on the apstrata account type, there is a limit on the number of predicates used in the Query condition, on the number of Documents returned in the results, and on the total size of the result set.

Specific Request Parameters

(Refer to Common Request Parameters)





Possible Values


Represents the saved query name




Specific Response Elements

(Refer to Common Response Elements)

The following specific "result" element is a child of the common root element "response" and a sibling of the common "metadata" element:

	"result": "XML definition of the requested saved query"

Specific Logical Errors

(Refer to Common Logical Error Codes)



Status Code





Query name should start with (a-z A-Z) followed by any alphanumeric character (a-z A-Z 0-9) and underscores (_). It should not be shorter than 3 characters or exceed 32.



The query that you are trying to update doesn't exist.



Sample Request

Request URL:[authenticationkey]/GetSavedQuery?apsws.time=[timestamp]&apsws.authSig=[signature] 

POST parameters:


Sample XML Response

Success XML:

<response xmlns="">

Failure XML:

<response xmlns="">

Sample JSON Response

{"response": {
    "metadata": {
        "requestId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "status": "success"
        "result": "<query>   <executeACL>creator</executeACL>  <store>myStore1</store>  <condition>startingDate[date]={startdate}</condition>  
        <ftsQuery>word</ftsQuery>  <returnedFields>  <field>firstName</field>  <field>lastName</field>  </returnedFields>  <sort>
        <field><name>firstName</name><type>string</type><order>DESC</order></field>  </sort>  <count>true</count>  <aggregate><expression>MAX($age)
        </expression><page>true</page><global>true</global>  </aggregate>  <resultsPerPage>10</resultsPerPage>  
        <forceCurrentSnapShot>false</forceCurrentSnapShot></query> "



  • No labels