Queries

Users are the people who access the company's Stockpit account.

Available queries

User - Returns a single user based on the id or email provided

query {
  User (id: 100012) {
    id
    label
    first_name
    last_name
    email
    active
    lang
  }
}

Users - Returns a list of users based on the filters defined

query {
  Users {
    data {
      id
      label
      first_name
      last_name
      email
      active
      lang
    }
  }
}


Available fields

id
Unique identifier of the user
label
Label of the user
first_name
First name of the user
last_name
Last name of the user
email
Email address of the user
active
If true, the user is active
lang
Language of the user (enum values : fr, en, ca)
created_at
Date and time the user was created
updated_at
Date and time the user was last updated
notifications
List of the notifications of the user
two_factor_authentication
If true, two-factor authentication is enabled for the user
active_user_profiles
List of the active user profiles of the user


Filters

You can create filters based on following fields

id
Example: {"column": "ID", "operator": "EQ", "value": 100012}
label
Example: {"column": "LABEL", "operator": "LIKE", "value": "%john%"}
active
Example: {"column": "ACTIVE", "operator": "EQ", "value": true}
first_name
Example: {"column": "FIRST_NAME", "operator": "LIKE", "value": "%John%"}
last_name
Example: {"column": "LAST_NAME", "operator": "LIKE", "value": "%Doe%"}
email
Example: {"column": "EMAIL", "operator": "EQ", "value": "[email protected]"}
created_at
Example: {"column": "CREATED_AT", "operator": "GT", "value": "2024-01-01 00:00:00"}
updated_at
Example: {"column": "UPDATED_AT", "operator": "LT", "value": "2024-12-31 23:59:59"}

Sorting

You can sort data based on following fields : id, label, first_name, last_name, email, lang, email_verified_at, created_at, updated_at

query Users(
  $orderBy: [QueryUsersOrderByOrderByClause!],
  $where: QueryUsersWhereWhereConditions,
  $first: Int,
  $page: Int
) {
  Users(
    orderBy: $orderBy
    where: $where
    first: $first
    page: $page
  ) {
    paginatorInfo {
      total
      count
      currentPage
      perPage
    }
    data {
      id
      label
      first_name
      last_name
      email
      active
      lang
    }
  }
}
{
  "orderBy": [
    {
      "column": "CREATED_AT",
      "order": "DESC"
    }
  ],
  "first": 50,
  "page": 1
}

Example of a query

query Users(
  $orderBy: [QueryUsersOrderByOrderByClause!],
  $where: QueryUsersWhereWhereConditions,
  $first: Int,
  $page: Int
) {
  Users(
    orderBy: $orderBy
    where: $where
    first: $first
    page: $page
  ) {
    paginatorInfo {
      total
    }
    data {
      id
      label
      email
      active
      lang
    }
  }
}
{
  "orderBy": [
    {
      "column": "CREATED_AT",
      "order": "DESC"
    }
  ],
  "first": 50,
  "page": 1,
  "where": {
    "AND": [
      {
        "AND": [
          {
            "column": "ACTIVE",
            "operator": "EQ",
            "value": true
          },
          {
            "column": "CREATED_AT",
            "operator": "GT",
            "value": "2020-01-01 00:00:00"
          }
        ]
      }
    ]
  }
}

Example of data returned

{
  "data": {
    "Users": {
      "paginatorInfo": {
        "total": 1,
        "count": 1,
        "currentPage": 1,
        "perPage": 50
      },
      "data": [
        {
          "id": 100012,
          "label": "John Doe",
          "email": "[email protected]",
          "active": true,
          "lang": "fr"
        }
      ]
    }
  }
}

Data types

User type

id
Unique identifier of the user
label
Label of the user
first_name
First name of the user
last_name
Last name of the user
email
Email address of the user
active
If true, the user is active
lang
Language of the user (enum values : fr, en, ca)
created_at
Date and time the user was created
updated_at
Date and time the user was last updated
notifications
List of the notifications of the user
two_factor_authentication
If true, two-factor authentication is enabled for the user
active_user_profiles
List of the active user profiles of the user

Lang enum

ValueDescription
frFrench
enEnglish
caCatalan