User groups#

Attention

To call services, the system must obtain an access token to system permission blitz_groups and include it in all called services.

Groups in Blitz Identity Provider are described by the following attributes:

  • id is the ID of the group in Blitz Identity Provider;

  • name is the name of the user group.

Getting group attributes by id#

Method

GET https://login.company.com/blitz/api/v2/grps/{id}

Getting the attributes of the group, if the id of the group is known.

URL parameters
  • profile is the name of the profile of user groups (for example, orgs);

  • expand is the value true, indicating that it is necessary to return all the attributes of the group.

Example

GET /blitz/api/v2/grps/14339e8e-a665-4556-92f1-5c348eff6696?profile=orgs HTTP/1.1
Authorization: Bearer cNwIXatB0wk5ZHO0xG5kxuuLubesWcb_yPPqLOFWDuwzMDc0Nz
Cache-Control: no-cache
{
    "instanceId": "Mzg…nU",
    "id": "14339e8e-a665-4556-92f1-5c348eff6696",
    "OGRN": "1234567890329",
    "INN": "7743151614",
    "name": "ООО Тестовая компания",
    "profile": "orgs"
}

Search for a group by attribute#

Method

GET https://login.company.com/blitz/api/v2/grps

Search for a group by attribute and getting all its attributes if the id of the group is unknown.

URL parameters
  • profile is the name of the user groups profile;

  • rql is a search query for group attributes in the format Resource Query Language (RQL).

    Operations:

    • and - simultaneous execution of search conditions;

    • or – alternative fulfillment of search conditions (for example, search by different attributes);

    • eq – checking the equality condition;

    • limit – a limit on the number of records to be returned.

  • expand (optional parameter):

    • true: include group attributes in the received response;

    • false: return only the IDs of the found groups.

Returns

JSON, containing a list of groups that meet the specified search conditions, indicating their identifier (id), as well as the values of the other attributes of the groups (in the case of expand=true).

Example

Search for a group by PSRN or TIN#
GET /blitz/api/v2/grps?profile=orgs&expand=true&rql=or(eq(OGRN,string:1230123456789),eq(INN,string:7743151614)) HTTP/1.1
Authorization: Bearer cNwIXatB0wk5ZHO0xG5kxuuLubesWcb_yPPqLOFWDuwzMDc0Nz
Cache-Control: no-cache
[
    {
        "instanceId": "Mzg5L…nU",
        "id": "14339e8e-a665-4556-92f1-5c348eff6696",
        "OGRN": "1234567890329",
        "INN": "7743151614",
        "name": "ООО Тестовая компания",
        "profile": "orgs"
    }
]

Creating a group#

Method

POST https://login.company.com/blitz/api/v2/grps

Creating a user group.

Request body
  • profile is the name of the user groups profile;

  • id is the unique identifier of the group;

  • the rest of the group’s attributes and their values.

Example

POST /blitz/api/v2/grps HTTP/1.1
Authorization: Bearer cNwIXatB0wk5ZHO0xG5kxuuLubesWcb_yPPqLOFWDuwzMDc0Nz
Content-Type: application/json

{
    "id":"95339e8e-a665-4556-92f1-5c348eff6696",
    "OGRN":"9876543210321",
    "INN":"5012345678",
    "name":"ООО Тестовая компания 2",
    "profile":"orgs"
}
{
    "instanceId": "b3Jnc…dQ",
    "name": "ООО Тестовая компания 2",
    "OGRN": "9876543210321",
    "id": "95339e8e-a665-4556-92f1-5c348eff6696",
    "profile": "orgs",
    "INN": "5012345678"
}

Changing group attributes#

Method

POST https://login.company.com/blitz/api/v2/grps/{id}?profile=orgs

Changing group attributes.

Request body

New set of attributes:

  • profile – the name of the group profile (must be passed both as part of the URL and in the request body);

  • id – group identifier;

  • the rest of the group’s attributes and their values.

Example

POST /blitz/api/v2/grps/5f7b0580-cd2e-4146-8fc5-6eb5a95c7b42?profile=orgs HTTP/1.1
Authorization: Bearer cNwIXatB0wk5ZHO0xG5kxuuLubesWcb_yPPqLOFWDuwzMDc0Nz
Content-Type: application/json

{
    "id": "5f7b0580-cd2e-4146-8fc5-6eb5a95c7b42",
    "OGRN": "1147746651733",
    "INN": "7715434658",
    "name": "Новое название",
    "profile": "orgs"
}
{
    "instanceId": "Mzg5L…nU",
    "id": "5f7b0580-cd2e-4146-8fc5-6eb5a95c7b42",
    "OGRN": "1147746651733",
    "INN": "7715434658",
    "name": "Новое название",
    "profile": "orgs"
}
The organization does not exist#
{
    "errors": [
        {
            "code": "group_not_found",
            "desc": "Group with '95339e8e-…97' id not found in '389-ds' LDAP group store",
            "params": {}
        }
    ]
}

Deleting a group#

Method

DELETE https://login.company.com/blitz/api/v2/grps/{id}?profile=orgs

Deleting a group.

Example

Request#
DELETE /blitz/api/v2/grps/5f7b0580-cd2e-4146-8fc5-6eb5a95c7b42?profile=orgs HTTP/1.1
Authorization: Bearer cNwIXatB0wk5ZHO0xG5kxuuLubesWcb_yPPqLOFWDuwzMDc0Nz

Getting a list of users in a group#

Method

GET https://login.company.com/blitz/api/v2/grps/{id}/members

Getting a list of users from a group.

URL parameters
  • profile is the name of the user groups profile;

  • expand (optional parameter):

    • true: include the user’s full name in the received response;

    • false: return only user IDs.

Example

expand=false#
GET /blitz/api/v2/grps/14339e8e-a665-4556-92f1-5c348eff6696/members?profile=orgs&expand=false HTTP/1.1
Authorization: Bearer cNwIXatB0wk5ZHO0xG5kxuuLubesWcb_yPPqLOFWDuwzMDc0Nz
Cache-Control: no-cache
expand=true#
GET /blitz/api/v2/grps/14339e8e-a665-4556-92f1-5c348eff6696/members?profile=orgs&expand=true HTTP/1.1
Authorization: Bearer cNwIXatB0wk5ZHO0xG5kxuuLubesWcb_yPPqLOFWDuwzMDc0Nz
Cache-Control: no-cache
expand=false#
[
    {
        "instanceId": "Mzg5L…J1",
        "subjectId": "d434b7d4-9816-460a-83aa-0a994226cbe7"
    },
    {
        "instanceId": "Mzg5L…J1",
        "subjectId": "2cafa5f4-bc84-4f6f-91aa-080da47975f0"
    }
]
expand=true#
[
    {
        "instanceId": "Mzg5L…J1",
        "family_name": "Иванов",
        "middle_name": "Иванович",
        "given_name": "Иван",
        "subjectId": "d434b7d4-9816-460a-83aa-0a994226cbe7"
    },
    {
        "instanceId": "Mzg5L…J1",
        "family_name": "Сергеев",
        "middle_name": "Сергеевич",
        "given_name": "Сергей",
        "subjectId": "2cafa5f4-bc84-4f6f-91aa-080da47975f0"
    }
]

Adding users#

Method

POST https://.../blitz/api/v2/grps/{id}/members/add?profile=orgs

Adding users to a group.

Request body

A list of users to be added to the group with their IDs (sub) in the subjectId attribute.

POST /blitz/api/v2/grps/5f7b0580-cd2e-4146-8fc5-6eb5a95c7b42/members/add?profile=orgs HTTP/1.1
Authorization: Bearer cNwIXatB0wk5ZHO0xG5kxuuLubesWcb_yPPqLOFWDuwzMDc0Nz
Content-Type: application/json

[
    {
        "subjectId": "45ff69f2-6c40-418f-a21d-cbe6f07b88c9"
    },
    {
        "subjectId": "cc8c4589-b2f8-40b8-b351-36d643808943"
    }
]
[
    {
        "instanceId": "Mzg5L…J1",
        "storeId": "tam",
        "subjectId": "45ff69f2-6c40-418f-a21d-cbe6f07b88c9"
    },
    {
        "instanceId": "Nzg5L…J1",
        "storeId": "tam",
        "subjectId": "cc8c4589-b2f8-40b8-b351-36d643808943"
    }
]
Attempt to add a non-existent user#
{
    "errors": [
        {
            "code": "user_not_found",
            "desc": "User with subjectId 'd2580c98-e584-4aad-a591-97a8cf45cd2q' not found",
            "params": {}
        }
    ]
}
An attempt to add a user who is already in the group#
{
    "errors": [
        {
            "code": "some_members_already_in_group",
            "desc": "Some of adding members are already included in group",
            "params": {}
        }
    ]
}

Removing users#

Method

POST https://../blitz/api/v2/grps/{id}/members/rm?profile=orgs

Removing users from the group.

Request body

A list of trusted persons excluded from the organization, indicating their identifiers (sub) in the subjectId attribute.

POST /blitz/api/v2/grps/5f7b0580-cd2e-4146-8fc5-6eb5a95c7b42/members/rm?profile=orgs HTTP/1.1
Authorization: Bearer cNwIXatB0wk5ZHO0xG5kxuuLubesWcb_yPPqLOFWDuwzMDc0Nz
Content-Type: application/json

[
    {
        "subjectId": "d2580c98-e584-4aad-a591-97a8cf45cd2a"
    }
]
[
    {
        "instanceId": "Mzg5L…J1",
        "storeId": "389-ds",
        "subjectId": "d2580c98-e584-4aad-a591-97a8cf45cd2a"
    }
]
An attempt to delete a user from the group who is no longer in it#
{
    "errors": [
        {
            "code": "some_members_not_in_group",
            "desc": "Some of removing members are not included in group",
            "params": {}
        }
    ]
}
Attempt to delete a non-existent user#
{
    "errors": [
        {
            "code": "user_not_found",
            "desc": "User with subjectId 'd2580c98-e584-4aad-a591-97a8cf45cd2b' not found",
            "params": {}
        }
    ]
}