Skip to main content
Version: 1.13.0

Profile Groups

Get Profile Groups

Query profileGroups() allows to get a list of all groups stored in the database.

profileGroups(filter: JSON = null
ids: [ID] = null
limit: Int = null
offset: Int = null
order: [String] = null): ProfileGroupsCollection!

filter: JSON: You can filter a group list by specifying one or several parameters:

  • creation_date: Exact group creation date in ISO 8601 format
  • id: ID assigned to a group from the database
  • info: JSON completely similar to info parameter of a group object
  • last_modified: Exact date of the last group modification in ISO 8601 format
  • profiles: List of profile IDs
  • title: Group name

ids: [ID]: To get a list of certain groups, specify their IDs in the list.

limit: Int: The parameter allows to get the first n profiles from the list.

offset: Int: The parameter allows to remove the first n profiles from the list.

order: [String]:

ProfileGroupsCollection!: The mutation result is a group list that contains the following parameters:

  • totalCount: Number of returned groups
  • collectionItems: [ProfileGroupOutput!]!:
    • id: Group ID
    • title: Group name
    • info: Additional group information in JSON format
    • lastModified: Last group modification date in ISO 8601 format
    • creationDate: Group creation date in ISO 8601 format
    • profileIds: List of IDs assigned to profiles which are linked to a group

Example Request:

{
profileGroups(ids: ["97c1a9fa-bfde-460a-9bda-f610060423ca"]) {
totalCount
collectionItems {
id
creationDate
info
lastModified
profileIds
title
}
}
}

Example Response:

API returns the following result:
{
"data": {
"profileGroups": {
"totalCount": 1,
"collectionItems": [
{
"id": "97c1a9fa-bfde-460a-9bda-f610060423ca",
"creationDate": "2022-07-07T07:21:06.428216+00:00",
"info": {
"color": "red.600"
},
"lastModified": "2022-07-07T07:21:06.428205+00:00",
"profileIds": [
"e4975119-cac7-4ced-ae3f-779bb1093c89",
"1cf13933-00be-4a6d-8dc3-3ff17f94aef8",
"b4a16647-1336-4ed8-a440-e4e8896e1de3"
],
"title": "My persons"
}
]
}
}
}

Create a Profile Group

Mutation createProfileGroup() is used to create a new group. The created group is automatically saved at

Server.

createProfileGroup(profileGroupData: ProfileGroupInput!): ProfileGroupModifyOutput!

profileGroupData: ProfileGroupInput!: JSON with the information required for creating a new group:

  • title: String!: New group name
  • info: JSON = null: Additional group information

ProfileGroupInput!: The mutation result is JSON with the following parameters:

  • ok: Boolean: Flag that mutation is successfully completed
  • profileGroup: ProfileGroupOutput: New group object

Example Request:

mutation{
createProfileGroup(profileGroupData: {title: "My new group"}) {
ok
profileGroup {
creationDate
id
info
lastModified
profileIds
title
}
}
}

Example Response:

API returns the following result:
{
"data": {
"createProfileGroup": {
"ok": true,
"profileGroup": {
"creationDate": "2022-07-08T07:44:10.766783+00:00",
"id": "d77c80eb-fffb-4812-a63c-cd8007270ef3",
"info": {},
"lastModified": "2022-07-08T07:44:10.766767+00:00",
"profileIds": [],
"title": "My new group"
}
}
}
}

Delete a Profile Group

Mutation deleteProfileGroup() allows to delete a profile group.

deleteProfileGroup(groupIds: [ID!]!): MutationResult!

groupIds: [ID!]!: List of IDs assigned to groups to be deleted

MutationResult!: The mutation result is JSON that contains the following parameters:

  • ok: Boolean: Flag that mutation is successfully completed

Example Request:

mutation{
deleteProfileGroup(groupIds: ["d77c80eb-fffb-4812-a63c-cd8007270ef3"]) {
ok
}
}

Example Response:

API returns the following result:
{
"data": {
"deleteProfileGroup": {
"ok": true
}
}
}

Update a Profile Group

Mutation updateProfileGroupInfo() is used to update group information.

updateProfileGroupInfo(profileGroupData: ProfileGroupModifyInput!
profileGroupId: ID!): ProfileGroupModifyOutput!

profileGroupData: ProfileGroupModifyInput!: JSON with the information to be updated:

  • title: Group name
  • info: Additional information about group

profileGroupId: ID!: Group ID

ProfileGroupModifyOutput!: The mutation result is JSON that contains the following parameters:

  • ok: Boolean: Flag that mutation is successfully completed
  • profileGroup: ProfileGroupOutput: Updated group object

Incorrect input errors:

  • Profile group not found by transmitted id:
{
"message": "Label matching query does not exist."
}

Example Request:

mutation{
updateProfileGroupInfo(profileGroupData: {title: "New group's name"}, profileGroupId: "800f0b65-7dbe-42b2-8f66-89af95a734e7") {
ok
profileGroup {
id
title
}
}
}

Example Response:

API returns the following result:
{
"data": {
"updateProfileGroupInfo": {
"ok": true,
"profileGroup": {
"id": "800f0b65-7dbe-42b2-8f66-89af95a734e7",
"title": "New group's name"
}
}
}
}

Add Profiles to Profile Groups

Mutation addProfilesToGroups() allows to add the selected profiles to one or several profile groups.

addProfilesToGroups(groupIds: [ID!]!
profilesIds: [ID!]!): ProfilesUpdateOutput!

groupIds: [ID!]!: List of group IDs

profilesIds: [ID!]!: List of profile IDs

ProfilesUpdateOutput!: The mutation result is JSON that contains the following parameters:

  • ok: Boolean: Flag that mutation is successfully completed
  • profiles: [ProfileOutput!]!: List of updated profiles

Incorrect input errors:

  • Profile not found by passed id:
{
"message": "Profile matching query does not exist."
}
  • Profile groups not found by passed ids:
{
"message": "One or several profiles_groups does not exist",
"code": "0x573bkd35"
}

Example Request:

mutation{
addProfilesToGroups(
groupIds: ["5b53aa69-d515-4fd3-81bf-c3d8696c3ab8", "800f0b65-7dbe-42b2-8f66-89af95a734e7"],
profilesIds: ["1cf13933-00be-4a6d-8dc3-3ff17f94aef8", "292a2f47-8bfd-4782-8fdf-c8b8189e300e", "3f4c1579-4e5e-4ef4-b9e1-a19808c4d931"]
) {
ok
profiles {
id
profileGroups {
id
}
}
}
}

Example Response:

API returns the following result:
{
"data": {
"addProfilesToGroups": {
"ok": true,
"profiles": [
{
"id": "1cf13933-00be-4a6d-8dc3-3ff17f94aef8",
"profileGroups": [
{
"id": "97c1a9fa-bfde-460a-9bda-f610060423ca"
},
{
"id": "5b53aa69-d515-4fd3-81bf-c3d8696c3ab8"
},
{
"id": "800f0b65-7dbe-42b2-8f66-89af95a734e7"
}
]
},
{
"id": "292a2f47-8bfd-4782-8fdf-c8b8189e300e",
"profileGroups": [
{
"id": "5b53aa69-d515-4fd3-81bf-c3d8696c3ab8"
},
{
"id": "800f0b65-7dbe-42b2-8f66-89af95a734e7"
}
]
},
{
"id": "3f4c1579-4e5e-4ef4-b9e1-a19808c4d931",
"profileGroups": [
{
"id": "edbb2c49-bacc-4b43-aac8-e06fd3da35eb"
},
{
"id": "5b53aa69-d515-4fd3-81bf-c3d8696c3ab8"
},
{
"id": "800f0b65-7dbe-42b2-8f66-89af95a734e7"
}
]
}
]
}
}
}

Remove Profiles from Profile Groups

Mutation removeProfilesFromGroups() is used to remove the selected profiles from one or several groups.

removeProfilesFromGroups(groupIds: [ID!]!
profilesIds: [ID!]!): ProfilesUpdateOutput!

groupIds: [ID!]!: List of group IDs

profilesIds: [ID!]!: List of profile IDs

ProfilesUpdateOutput!: The mutation result is JSON that contains the following parameters:

  • ok: Boolean: Flag that mutation is successfully completed
  • profiles: [ProfileOutput!]!: List of updated profiles

Incorrect input errors:

  • Profile not found by passed id:
{
"message": "Profile matching query does not exist."
}
  • Profile groups not found by passed ids:
{
"message": "One or several profiles_groups does not exist",
"code": "0x573bkd35"
}

Example Request:

mutation{
removeProfilesFromGroups(
groupIds: ["5b53aa69-d515-4fd3-81bf-c3d8696c3ab8", "800f0b65-7dbe-42b2-8f66-89af95a734e7"],
profilesIds: ["1cf13933-00be-4a6d-8dc3-3ff17f94aef8", "292a2f47-8bfd-4782-8fdf-c8b8189e300e", "3f4c1579-4e5e-4ef4-b9e1-a19808c4d931"]
) {
ok
profiles {
id
profileGroups {
id
}
}
}
}

Example Response:

API returns the following result:
{
"data": {
"removeProfilesFromGroups": {
"ok": true,
"profiles": [
{
"id": "1cf13933-00be-4a6d-8dc3-3ff17f94aef8",
"profileGroups": [
{
"id": "97c1a9fa-bfde-460a-9bda-f610060423ca"
}
]
},
{
"id": "292a2f47-8bfd-4782-8fdf-c8b8189e300e",
"profileGroups": []
},
{
"id": "3f4c1579-4e5e-4ef4-b9e1-a19808c4d931",
"profileGroups": [
{
"id": "edbb2c49-bacc-4b43-aac8-e06fd3da35eb"
}
]
}
]
}
}
}