SDK
SDK Jvm v1.x
2

query #

Base method used to send queries to Kuzzle, following the API Documentation.

This is a low-level method, exposed to allow advanced SDK users to bypass high-level methods.

:::: tabs ::: tab Java

Arguments #

public CompletableFuture<Response> query(
  Map<String, Object> query)
      throws InternalException, NotConnectedException
Available since 1.2.3
public CompletableFuture<Response> query(
  String query)
      throws InternalException, NotConnectedException

public CompletableFuture<Response> query(
  RawJson query)
      throws InternalException, NotConnectedException

public CompletableFuture<Response> query(
  RequestPayload query)
      throws InternalException, NotConnectedException

public CompletableFuture<Response> query(
  Object query)
      throws InternalException, NotConnectedException

ArgumentTypeDescription
queryMap<String, Object>API request
Available since 1.2.3
ArgumentTypeDescription
queryMap<String, Object>, String, RawJson, RequestPayload or ObjectAPI request

Calling query with a String or RawJson makes no differences, and will be interpreted as raw json strings.

::: warn Calling query directly with a String or RawJson causes the SDK to deserialize the query, add some properties, then reserialize the query.

This can decrease performances when giving big JSON payloads.

If you have big JSON body payloads to send, consider using a Map and only use a RawJson for the body property. This will avoid the deserialization + reserialization slowdown :::

query #

All properties necessary for the Kuzzle API can be added in the query object. The following properties are the most common.

PropertyTypeDescription
controllerStringController name (mandatory)
actionStringAction name (mandatory)
bodyMap<String, Object>, RawJson or ObjectQuery body for this action
indexStringIndex name for this action
collectionStringCollection name for this action
_idStringid for this action
volatileMap<String, Object>, RawJson or ObjectAdditional information to send to Kuzzle
headersMap<String, Object>Optionnal headers to send (HTTP Only)

Returns #

Returns a Response object which represents a raw Kuzzle API response. See the API Documentation.

Usage #

<<< ./snippets/query-java.java

::: ::: tab Kotlin

Arguments #

fun query(query: Map<String?, Any?>): CompletableFuture<Response>
Available since 1.2.3
fun query(query: RawJson): CompletableFuture<Response>
fun query(query: String): CompletableFuture<Response>
fun query(query: RequestPayload): CompletableFuture<Response>
fun query(query: Any): CompletableFuture<Response>

ArgumentTypeDescription
queryMap<String?, Any?>API request
Available since 1.2.3
ArgumentTypeDescription
queryMap<String?, Any?>, RawJson, String, RequestPayload or AnyAPI request

Calling query with a String or RawJson makes no differences, and will be interpreted as raw json strings.

::: warn Calling query directly with a String or RawJson causes the SDK to deserialize the query, add some properties, then reserialize the query.

This can decrease performances when giving big JSON payloads.

If you have big JSON body payloads to send, consider using a Map and only use a RawJson for the body property. This will avoid the deserialization + reserialization slowdown :::

query #

All properties necessary for the Kuzzle API can be added in the query object. The following properties are the most common.

PropertyTypeDescription
controllerStringController name (mandatory)
actionStringAction name (mandatory)
bodyMap<String, Object>, RawJson or AnyQuery body for this action
indexStringIndex name for this action
collectionStringCollection name for this action
_idStringid for this action
volatileMap<String, Object>, RawJson or AnyAdditional information to send to Kuzzle
headersMap<String, Any?>Optionnal headers to send (HTTP Only)

Returns #

Returns a Response object which represents a raw Kuzzle API response. See the API Documentation.

Usage #

<<< ./snippets/query-kotlin.kt

::: ::::