Documentation

Queries

In this article

After setting up a connection with the Playground, you can start collecting data through queries. In this article, we're looking at some example on how to do this.

Robert van Boesschoten

Published: 29-04-2020

Last updated: 30-04-2020

Note: Connecting through the Playground will also give you an entire list of queries available. This article is meant for examples of different options.

For the examples in this article, we'll be using a `Task` model. Apply queries for your own implementation using models of your application.

Get all Tasks

This query will return an overview of all Task records, containing the properties' values as configured.

{
    allTask {
        results {
            id
            task
        }
    }
}

Example

Get Tasks with where filter

This query will return an overview of all Task records matching the criteria in the `where` filter, containing the properties' values as configured.

{
    allTask(where: { id : { in: [3, 4]} } ){
        results {
            id
            task
        }
    }
}

Example

Get one Task

This query will return the first Task record matching the criteria in the `where` filter, containing the properties' values as configured.

{
    oneTask (where: { id : { eq: 3} } ) {
        id
        task
    }
}

Example


Get Tasks sorted in a specific order

This query will return an overview of multiple Task records in an ascending or descending order of the specified property, containing the properties' values as configured. Accepts `ASC` and `DESC`

{
    allTask(sort: {field: id, order: DESC}) {
        results {
            id
        }
    }
}

Example


Get task with relational data

This query will return the first Task record matching the criteria in the `where` filter, containing the properties' values as configured, including all configured values of a related record.

Note: Make sure the authorization on the relational data is setup properly. The (un)authenticated should be able to query the related data. Otherwise an ‘Unauthorized’ error will be shown.

{
    oneTask (id:3) {
        id
        task
        webUser {
            id
            email
        }
    }
}

Example


Retrieving file properties

This query will return the Task records matching the criteria in the `where` filter, containing the properties' values as configured, including the configured File property values (`name`, `URL`).

query {
    allArtists {
        results {
            name
            songs {
                art {
                name
                url
                }
            }
        }
    }
}

In this article