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 formatid
: ID assigned to a profile from the databaseinfo
: Object with the following parameters:age
: Profile age. For example, a request with a parameterinfo_age:28
returns a list of profiles with age equal to 28.gender
: Profile gender. For example, a request with a parameterinfo_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 formatprofile_groups
: List of group IDssamples
: 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 profilescollectionItems: [ProfileOutput!]
id
: Profile IDlastModified
: Last profile modification date in ISO 8601 formatcreationDate
: Profile creation date in ISO 8601 formatinfo
: Profile information (approximate age, gender, avatar ID, the best sample ID)samples
: List of profile samplesprofileGroups
: List of profile groupsmainSample
: The best profile sampleavatar
: Profile avataractivities
: All profile activitiesactivitiesCount
: Number of profile activitiesfirstActivityDate
: The first profile activity date recorded by the system in IS O8601 formatlastActivityDate
: 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 OMNI Platform 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.
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 toinfo: 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 completedprofile: ProfileOutput!
: New profile objectisCreated: 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"
}
}
}
}
Create a profile by search
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 completedprofile: 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.
- name
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.
- name
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"
]
}
}
}