1. Introduction

To make changes or use user profiles in other endpoints your application needs to know the id of the user to reference it. For this purpose, MyQ includes an endpoint called GET /v2/users/. With this, you can search, filter and get ids of multiple or just one specific user.

2. Prerequisites

REST API application in MyQ → Settings → External Systems has to have access to scope called Users and the logged user over the Access token has to have rights to Manage users or Administrator right.

3. Calling the API

The endpoint we will in this guide is defined as:

Endpoint:
GET /v2/users

Authentication:
Grant_type: client_credentials
Scopes: []

Headers:
Content-Type: application/json
Authentication: Bearer %access_token%

Body: {}

CODE

Note that the %access_token% needs to be replaced by the token you received as a response from auth endpoint. Calling this endpoint with no GET parameters result in an empty responded JSON.

3.1. Filtering the search

Name

Type

Description

email

string

An Email of the User.

name

string

An Username of the User.

card

string

One of the Card of the User.

code

string

The code (personal number) of the User.

GET /v2/users?username=myquser1
CODE

In this example, we try to filter search to a single user with a username myquser1. If this user exists his information is returned. If he is not present response JSON is empty with a count parameter equal to 0.

4. Response

Code:
2xx

Response:
{
   "users":[
      {
         "id":0,
         "username":"string",
         "fullname":"string",
         "email":"string",
         "scanStorage":"string",
         "code":"string",
         "syncSource":"string",
         "lang":"string",
         "phone":"string",
         "ldapDomain":"string",
         "notes":"string"
      }
   ],
   "count":0
}
CODE

Response JSON includes all the users that matched the search. All information about the user is displayed including the id parameter we were looking for. This can be later used in many endpoints. For example when generating a new pin for the user. The count parameter is set to how many users were found by the search.