Skip to main content
Version: 1.12.0

Profiles

Get Profiles

Query profiles() allows you to get a list of all created profiles.

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

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

  • creation_date: Exact profile creation date in ISO 8601 format
  • id: ID assigned to a profile from the database
  • info: Object with the following parameters:
    • age: Profile age. For example, a request with a parameter info_age:28 returns a list of profiles with age equal to 28.
    • gender: Profile gender. For example, a request with a parameter info_gender: “MALE” returns a list of male profiles.
    • main_sample_id: ID assigned to the best profile sample.
    • avatar_id: ID of profile avatar.
  • last_modified: Exact date of the last profile modification in ISO 8601 format
  • profile_groups: List of group IDs
  • samples: Sample ID

ids: [ID]: To get a list with certain profiles, 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 exclude the first n profiles from the list.

order: [String]: You can sort the list by specifying the value for the following parameters: creation_date, id, info, last_modified, profile_groups, samples.

ProfilesCollection!: The query result is a profile list that contains the following parameters:

  • totalCount: Number of returned profiles
  • collectionItems: [ProfileOutput!]
    • id: Profile ID
    • lastModified: Last profile modification date in ISO 8601 format
    • creationDate: Profile creation date in ISO 8601 format
    • info: Profile information (approximate age, gender, avatar ID, the best sample ID)
    • samples: List of profile samples
    • profileGroups: List of profile groups
    • mainSample: The best profile sample
    • avatar: Profile avatar
    • activities: All profile activities
    • activitiesCount: Number of profile activities
    • firstActivityDate: The first profile activity date recorded by the system in IS O8601 format
    • lastActivityDate: The last profile activity date recorded by the system in ISO 8601 format

Example Request:

{
profiles(ids: ["1cf13933-00be-4a6d-8dc3-3ff17f94aef8"]) {
totalCount
collectionItems {
id
avatar
creationDate
firstActivityDate
info
lastActivityDate
lastModified
mainSample {
id
}
profileGroups {
id
}
samples {
id
}
activitiesCount
activities {
id
}
}
}
}

Example Response:

API returns the following result:
{
"data": {
"profiles": {
"totalCount": 1,
"collectionItems": [
{
"id": "1cf13933-00be-4a6d-8dc3-3ff17f94aef8",
"avatar": "dc3e1949-b4e8-4feb-a51c-67740e323e8b",
"creationDate": "2022-07-07T08:59:56.227343+00:00",
"firstActivityDate": "2022-07-07T12:36:51.644000+05:00",
"info": {
"age": 36,
"gender": "MALE",
"avatar_id": "dc3e1949-b4e8-4feb-a51c-67740e323e8b",
"main_sample_id": "3071e862-7116-4ed3-94f1-309b0b5b912f"
},
"lastActivityDate": "2022-07-07T12:37:07.425000+05:00",
"lastModified": "2022-07-07T09:00:15.028365+00:00",
"mainSample": {
"id": "3071e862-7116-4ed3-94f1-309b0b5b912f"
},
"profileGroups": [
{
"id": "97c1a9fa-bfde-460a-9bda-f610060423ca"
}
],
"samples": [
{
"id": "3071e862-7116-4ed3-94f1-309b0b5b912f"
}
],
"activitiesCount": 5,
"activities": [
{
"id": "78f7c795-0f28-42ce-a9d2-818095dd5f84"
},
{
"id": "a4ddc400-8fb8-41ef-aacb-9fc195868368"
},
{
"id": "ea4ba238-4c64-4e07-bed6-d8f29f426e7e"
},
{
"id": "29c8b4f5-11d0-4523-a17f-748ba25d4b97"
},
{
"id": "4a1cad4a-ed81-409e-8a16-38abe9145a77"
}
]
}
]
}
}
}

Сreate a Profile

Mutation createProfile() is used to create a new profile. The created profile is automatically saved at

Server.

createProfile(image: CustomBinaryType = null
profileData: ProfileInput = null): ProfileCreateOutput!

image: CustomBinaryType: To add an avatar to a new profile, submit a base64 encoded image with the size up to 8MB.

info

You can also create a profile from a sample by passing its identifier in the main_sample_id field. However, in this case, the profile will not be included in the search index.

profileData: ProfileInput: To add the supplemental information to be saved at the new profile, submit the following parameters:

  • profileGroupIds: [ID]: List of IDs assigned to groups which a new profile is linked to
  • info: JSON: Additional infromation about profile (age: Int, gender: "MALE" | "FEMALE")

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

  • ok: Boolean: Flag that mutation is successfully completed
  • profile: ProfileOutput!: New profile object
  • isCreated: Boolean!: The parameter determines whether a new profile is created or a photo is attached to the existing profile.

Incorrect input errors:

  • Image is transmitted in poor quality:
{
"message": "Low quality photo",
"code": "0x86bd49dh"
}
  • Profile groups not found by passed ids:
{
"message": "One or several profiles_groups does not exist",
"code": "0x573bkd35"
}

Example Request:

mutation{
createProfile {
isCreated
ok
profile {
id
}
}
}

Example Response:

API returns the following result:
{
"data": {
"createProfile": {
"isCreated": true,
"ok": true,
"profile": {
"id": "d5ca09fb-199a-471f-99ca-b9b4954fb45f"
}
}
}
}

Create a Profile from Activity

Mutation createProfileByActivity is used to create a profile using a detected activity.

createProfileByActivity(activityId: ID!
profileData: ProfileInput = null): ProfileCreateOutput!

activityId: ID!: ID assigned to the activity upon which a profile should be created.

profileData: ProfileInput: You can specify the additional information to be saved at profile:

  • profileGroupIds: [ID]: List of IDs assigned to the groups which the new profile is linked to.
  • info: JSON: Additional information about profile (age: Int, gender: "MALE" | "FEMALE")

ProfileCreateOutput:The mutation result is JSON that contains the following parameters:

  • ok: Boolean!: Attribute that mutation is successfully completed.
  • profile: ProfileOutput!: New profile object.
  • isCreated: Boolean!: Determines if a new profile is created or a photo was linked to the existing profile.

Incorrect input errors:

  • Error when trying to create a profile from an anonymous activity:
{
"message": "Activity is anonymous",
"code": "0x358vri3s"
}
  • Activity not found by passed id:
{
"message": "Activity 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{
createProfileByActivity(activityId: "78f7c795-0f28-42ce-a9d2-818095dd5f84") {
ok
isCreated
profile{
id
}
}
}

Example Response:

API returns the following result:
{
"data": {
"createProfileByActivity": {
"ok": true,
"isCreated": false,
"profile": {
"id": "1cf13933-00be-4a6d-8dc3-3ff17f94aef8"
}
}
}
}

Mutation createProfileWithSearch is used to create a profile by search result. This API is deprecated.

Update a Profile

Mutation updateProfile() is used to update profile information.

updateProfile(profileData: ProfileInput!
profileId: ID): ProfileUpdateOutput!

profileData: ProfileInput!: Profile information to be updated (profileGroupIds: [ID], info: JSON)

profileId: ID: Profile ID

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

  • ok: Boolean: Flag that mutation is successfully completed
  • profile: ProfileOutput!: Updated profile object

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{
updateProfile(profileData: {info: {age: 20}}, profileId: "d5ca09fb-199a-471f-99ca-b9b4954fb45f") {
ok
profile {
id
}
}
}

Example Response:

API returns the following result:
{
"data": {
"updateProfile": {
"ok": true,
"profile": {
"id": "d5ca09fb-199a-471f-99ca-b9b4954fb45f"
}
}
}
}

Delete a Profile

Mutation deleteProfiles() is used to delete profiles.

deleteProfiles(profileIds: [ID!]!): MutationResult!

profileIds: [ID!]: List of IDs assigned to profiles to be deleted

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

  • ok: Boolean: Flag that mutation is successfully completed

Incorrect input errors:

  • List of profile ids passed for deletion is empty:
{
"message": "Empty profiles ids list",
"code": "0xd2ae0ef8"
}

Example Request:

mutation{
deleteProfiles(profileIds: "d5ca09fb-199a-471f-99ca-b9b4954fb45f") {
ok
}
}

Example Response:

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

Add Custom Fields for Profiles

Mutation addProfilesField is used to create profile fields.

mutation {
addProfilesField()
{
}
}

  • fieldInput:

    • name
      • Name of a new profile field
      • Data type: String.
  • ok

    • Mutation completion status
    • Data type: Boolean.
  • fields

    • List of current profile fields
    • Data type: String.

Example Request:

mutation {
addProfilesField(fieldInput: {name: "City"})
{
ok
fields
}
}

Example Response:

API returns the following result:
{
"data": {
"addProfilesField": {
"ok": true,
"fields": [
"name",
"age",
"gender",
"birthday",
"avatar_id",
"main_sample_id",
"description",
"city"
]
}
}
}

Delete Custom Fields from Profiles

Mutation removeProfilesField is used to delete profile fields.

mutation {
removeProfilesField() {
}
}

  • fieldInput:

    • name
      • Name of a profile field to be deleted
      • Data type: String.
  • ok

    • Mutation completion status
    • Data type: Boolean.
  • fields

    • List of current profile fields
    • Data type: String.

Example Request:

mutation {
removeProfilesField(fieldInput: {name: "City"})
{
ok
fields
}
}

Example Response:

API returns the following result:
{
"data": {
"removeProfilesField": {
"ok": true,
"fields": [
"name",
"age",
"gender",
"birthday",
"avatar_id",
"main_sample_id",
"description"
]
}
}
}