Query Data from an App

The /query endpoint is used to query entity data from any app within Kahua. This is one of the most commonly used endpoints due to the flexibility it provides in querying specific data from any app in Kahua

Endpoint

POST /v2/domains/{domainKey}/projects/{projectId}/query?returnDefaultAttributes=true

Path Parameters

Parameter Type Description
domainKey string The domain key. Value can be found from within Kahua in Domain Settings -> Authentication
projectId integer The project ID of the project the query should run against.

Query Parameters

Parameter Type Description
returnDefaultAttributes boolean This is an optional URL parameter that defaults to false. When set to true, this will return all attributes for the queried entity regardless of whether they are null or not. This includes many system attributes that are part of every entity in Kahua. It is recommended that this parameter only be used when explicitly needed for things such as generating sample/mapping data sets, as it can greatly increase the size of the response payload when used on queries that return many records.

This endpoint uses a POST command rather than a GET, even though it is getting/pulling data from the server. This is because this endpoint requires a JSON query to be passed in via the Request Body of the API request (which GET requests do not support).

The v2 endpoint works exactly the same as the v1 endpoint, with the exception that the result set returned is in a more "standard" JSON format that is more compact, easier to read, and easier to parse.

Request Body

The body of the request is where all the main details for the query are provided. This can range from very simple to very complex as there are numerous options that can be used to filter, change scope, and sort the data. The following examples demonstrate how to use different request bodies.

Response Body

Examples