Managing users

This page will show you how to manage users

In an earlier page we explained how to create a user. This page will explain how to manage users by API and has the following sections:

Users can also be managed manually from the user management section of our web app.

Getting user details

Getting a list of all users is done as follows:

curl {baseURL}/users?page=0&size=10 
-H "Authorization:your-api-key"  
-X GET

The response will look as follows:

{
    "links":
    [
        {
            "rel": "self",
            "href": "https://api.yordex.com/users?page=0&size=10&sort=modificationDate,desc"
        }
    ],
    "content":
    [
        {
            "id": "user-id-1",
            "firstName": "John",
            "lastName": "Smith",
            "gender": "M",
            "email": "[email protected]",
            "roles":
            [
                "ROLE_TRADER_STANDARD"
            ],
            "traderId": "your-trader-id",
            "mobileNumberCountryCode": "44",
            "mobileNumber": "7777123456",
            "customerUserId": "ID2345",
            "enabled": true,
            "emailConfirmed": true
        },
        {
            "id": "user-id-2",
            "firstName": "Delia",
            "lastName": "Smith",
            "gender": "F",
            "email": "[email protected]",
            "roles":
            [
                "ROLE_TRADER_ADMIN"
            ],
            "traderId": "your-trader-id",
            "mobileNumberCountryCode": "44",
            "mobileNumber": "7777123457",
            "customerUserId": "ID3456",
            "enabled": true,
            "emailConfirmed": true
        }
    ],
    "page":
    {
        "size": 10,
        "totalElements": 2,
        "totalPages": 1,
        "number": 0
    }
}

Getting an individual user is done as follows:

curl {baseURL}/users/user-id
-H "Authorization:your-api-key"  
-X GET

The response will be similar as when getting a list of users.

Updating a user

Updating a user works in exactly the same way as creating a user:

curl {baseURL}/users/user-id  
-H "Authorization:your-api-key"  
-H "Content-type: application/json"  
-X PUT  
-d '{
  "firstName": "John",
  "lastName": "Smith",
  "gender": "M",
  "roles":["ROLE_TRADER_STANDARD"],
  "mobileNumberCountryCode": "44",
  "mobileNumber": "7777123456",
  "customerUserId": "ID2345"
}'

The only field that cannot be updated is the email address.

Suspending a user

Suspending a user is done as follows:

curl {baseURL}/users/user-id/suspend
-H "Authorization:your-api-key"  
-X POST

Suspended user data will still be available but they will not be able to login to the system.

When a user is suspended, all cards assigned to that user will be cancelled. It is possible to re-assign a card before suspending a user to prevent that from happening.