HTTP API - DQL Queries
this article provides an overview of how to perform ditto query language (dql) queries in ditto using the http data api rpc endpoint use the following endpoint to execute your queries https //\<cloud endpoint>/api/v4/store/execute dql support the dql http api supports the following dql commands select insert update evict is not currently available for the big peer, although it's in development to learn more about removing data from your big peer instance, see writing http (legacy) docid\ jmhbyt6shuvf5rk8qgumv select to retrieve documents from a collection, use a select statement and, if desired, include optional clauses pinpointing criteria to further filter results for more information, see ditto query language > select docid 1bfchjoxcgv01keflfvvu optional clauses for filtering the following table provides an overview of the various clauses you can use to set granular controls for filter operations clause description \<font color="#db2777">from\</font> the required clause specifying the collection containing the documents for retrieval (see from docid 1bfchjoxcgv01keflfvvu ) \<font color="#db2777">where\</font> applies filtering conditions to restrict the documents included in the result set (see where docid 1bfchjoxcgv01keflfvvu ) \<font color="#db2777">order by\</font> s pecifies the sorting order of the result set based on one or more expressions (see order by docid 1bfchjoxcgv01keflfvvu ) \<font color="#db2777">limit\</font> restricts the number of documents included in the result set (see limit docid 1bfchjoxcgv01keflfvvu ) \<font color="#db2777">offset\</font> skips a specific number of documents before returning the result set (see offset docid 1bfchjoxcgv01keflfvvu ) basic select operation the following syntax outlines the basic structure of a select statement dql select from collection curl request for instance, performing the following curl request to select documents from the cars collection curl x post "https //\<cloud endpoint>/api/v4/store/execute" \\ \ header 'authorization \<authorization token>' \\ \ header 'content type application/json' \\ \ data raw '{ "statement" "select from cars" }' response object after invoking a request to insert documents, ditto returns a response object similar to the following example { "transactionid" 100, "querytype" "select", "items" \[{ " id" "123", "color" "blue" },{ " id" "456", "color" "red" }], "mutateddocumentids" \[], "error" {}, "warnings" \[], "totalwarningscount" 0 } insert with arguments to create new documents, use an insert statement and, if desired, optional arguments defining the fields to include dql insert into cars documents (\ doc1), (\ doc2) curl request for example, initiating creating doc1 and doc2 as follows curl x post "https //\<cloud endpoint>/api/v4/store/execute" \\ \ header 'authorization \<authorization token>' \\ \ header 'content type application/json' \\ \ data raw '{ "statement" "insert into cars documents (\ doc1), (\ doc2)", "args" { "doc1" { " id" "123", "color" "blue" }, "doc2" { " id" "456", "color" "red" } } }' sample response { "transactionid" 100, "querytype" "mutation", "items" \[], "mutateddocumentids" \["123", "456"], "error" {}, "warnings" \[], "totalwarningscount" 0 } update to modify the content of existing documents in a collection, use the \<font color="#db2777">update\</font> operation dql update your collection name set field1 = value1, field2 > \[mutator], where \[condition] for more information, see ditto query language > update docid vxfd7 jjfftzbyivqoxh response object definition the following snippet outlines the structure of a typical response for insert or update document operations { // transaction identifier 	"transactionid" number, // possible values // "select" // "mutation" (for insert or update operations) // "unknown" (when returning an error before the query is known) "querytype" string, // array of documents only populated for select queries "items" \[ ], // document ids of documents modified by insert or update operations "mutateddocumentids" \[ ], // a single error it prevents the query from executing / completing // will always be present, even if there are no errors "error" { // description of error not present if no errors "description" string }, // array of warnings max 10 will be shown // will always be present, even if there are no warnings "warnings" \[ { // document identifier may not be present " id" string, // description of warning "description" string } ], // total number of warnings during query execution, including those in the // `warnings` property above "totalwarningscount" number }