Coly ME (Match Engine) API documentation


Version 1.0

Table of contents

 

 

 

Introduction


The Coly ME API Documentation provides descriptive information for developers who would like to integrate the functionality of the Coly ME API into their solution.

The Coly ME engine is provided in four simple steps.

  1. Create a person.
  2. Distribute the link to the person for the assessment and profile.
  3. Create a group and assign persons to it.
  4. Match.

The API endpoints are documented in the same order as the user flow above.

Go to API section to get started!

 

 

Data Lifecycle Description


Our data models have several types(or layers) that define our approach. Simply speaking, the data lifecycle reveals steps and actions that should be taken to reach them.

Group
Person
Assignment
Feedback
Label
PsychometricTest

Diagram1: Visualisation of model dependencies

 

Primary models


Core-level models contain crucial data for system operations.

 

Person model


Person record access available
Assignment model
Archived
Updated
Joined2Group
LeftGroup
Created
Closed
Opened
Disabled
Anonymised

 

Group model


Group record access available
Assignment model
Archived
Updated
PersonJoined
PersonLeft
Created
Closed
Opened
Disabled
Anonymised

 

 

API Endpoints & Auth header


Base API URL:

 

To connect with our API, you will need to generate an API key. Please follow these steps:

  1. Visit your settings page at Coly Console Settings.
  2. Follow the instructions to generate your unique API key.

After obtaining the API key, include it in all requests by setting the Authorization header as follows:

Remember to replace {yourApiKey} with your actual API key.

For example:

 

 

Main Response Structure


Our API leverages the Either pattern, a common approach in functional programming, to standardize the structure of all responses. This strategy enables the API to always return a 200 status code, regardless of whether the operation was successful. The outcome of the operation is conveyed in the response's type field, which can be either 'success' or 'failure'.

Note: While the following example uses TypeScript, the 'Either' pattern is language-agnostic and can be adapted to your preferred programming language:

 

In every response, you'll find the data property structured as one of the following:

 

The value of a successfull response will vary across different requests, but all error messages will conform to this structure:

 

In this format, the message field provides a human-readable explanation primarily for debugging. However, it may change over time, so it should not be relied upon for application logic. On the other hand, the FailCode is a unique, constant identifier for a specific type of failure and can be used to handle errors in your application.

Every API endpoint will provide a list of possible FailCodes for each request.

 

Here are examples of a successful and a failed request:

 

 

One common FailCode for all requests is InputValidation::Failed, which signifies an issue with the request body format. Example:

 

For the remainder of this API documentation, we will describe the structure of the 'value' field and the potential FailCodes for each request.

Although almost all requests return a 200 status code, there are a few exceptions:

 

 

Basic query params


For any of the entities below (person and group), the following query params are supported when fetching from the backend:

 

Example:

  1. To fetch the first 20 persons in ascending order by their last name and include their personality traits in the response, use the following query:

 

 

Persons


The Persons entity mainly refers to the tenants within a shared living space, or persons taking the Psychometry Assessment using our product. Each person will have their Personality and coreValues traits calculated after taking the assessment. The score they get will play a key role in matching the individual to a specific group.

 

Create person


Creates Persons record and returns it. It requires email , firstname, lastname to create a Persons record.

 

Example request body

 

Response example

 

 

Get person information


Retrieve a single person's record with all the detailed pieces of information that you need.

 

Response example

 

 

Get person unique assessment & profile link


Retrieves the Persons unique URL link for their Psychometry Assessment and/or Coly ME profile. This URL link will take you to the Coly ME Profile App (https://profile.coly.io/). By default, when the Persons opens the link, the Psychometry Assessment will be presented. When Psychometry Assessment is Ready(completed), the link will display the Persons Coly ME profile with the result from the assessment.

 

Response example

 

 

Get list of persons


Retrieves the list of person's records, with the total number of Persons and their detailed pieces of information.

 

Response example

 

Available query options for person relations:

 

 

Update person


 

Example request body

 

Response example : Changed person name

 

 

Psychometric Assessment invite


Creates Psychometric Assessment if none exists, and sends email request. If a psychometric assessment already exists a reminder email will be sent.

 

Archive person


Archive Persons record status.

 

Response example : Archive person

 

 

Restore person from archive


Restores a Persons record from the archive.

 

Response example : Restore the achived person

 

 

Delete person from archive


Disabling and deleting Persons record from archived.

Note that only the archived records can be deleted.

 

 

Person Error Codes


Here are the possible error codes for a failure response in the persons route.
Record Not Found

When the desired record is missing:

 

Email Already In Use

When creating a Person record, the user's email should be unique and not be reused unless the person has been removed from the platform:

 

Archived Record Restriction

For archived records, they are not allowed to be matched, or assigned to groups. To achieve this, you would need to restore the record first:

 

For non-archived records, you would have to archive the record first to disable/delete it:

 

Unknown

If there is a case of an unknown Error, there is a high chance of server-side error. Contact us through our email dev@coly.io with detailed information about the error:

 

Groups


The Groups entity is a collection of Persons. Usually refers to a group of Persons who live in a shared living space. A group is created by title and capacity. A group with persons contains a calculated average score of the personality and coreValues, scale that can be used to match an incoming person.

 

 

Create group


Creates Group record and returns it. It requires a Group name and a capacity of persons for the group.

 

Example request body

 

Response example

 

 

Get group information


Retrieve a single Group record with all the detailed pieces of information that you need, including Personality and coreValues percentile.

 

Response example 1

 

Response Example 2:

 

 

Get list of groups


Retrieves a list of Groups records, with the total number of groups and detailed information about each group.

 

Response example:

 

Available query options for group statuses:

 

Available query options for group relations:

 

 

Update group


Updates Group record fields and returns it updated. You can alter the name and the capacity of the group record you created.

 

Example request body

 

Response example : Changed group capacity

 

 

Archive group


Archive Group record status.

 

Response example : Archive group

 

 

Restore group from archive


Restores a Group record from the archive.

 

Response example : Restore the archived group

 

 

Delete group from archive


Disabling and deleting Group record from archived.

Note that only the archived records can be deleted.

 

Response example: Group record deleted

 

 

Group Error Codes


Record Not Found

When the desired record is missing:

 

Group Name Already In Use

When creating a Group record, the group's name should be unique. This includes the archived groups as well:

 

Archived Record Restrictions

For archived records, you'll need restore them before they can be used again:

 

For non-archived records, you would have to archive the record first to disable/delete it:

 

Not Empty

In case there's an operation such as archive on a non-empty group record:

 

Unknown

If there is a case of an unknown Error, there is a high chance of server-side error. Contact us through email at dev@coly.io with detailed information about the error:

 

 

Assignments


Assignments are used for adding and removing Persons to and from a Group. Assignments are indicating the relation between Persons and Groups records.

 

Assign person to group


Assign a Person to a Group. You would need both groupId and personId to create assignment records.

 

Example request body

 

Response example

 

#####

Remove person from group


Remove a Person from a Group. This closes the assignment for specified person by deleting or removing the assignment record.

 

Example request body

 

Response example

 

 

Assignment Error Codes


##### Group Overflow

When no vacancies are left for the group, attempting to assign new person records will not be possible:

 

Assigned Person Record Restriction

Person records are only allowed to be assigned to one group at a time. In case of attempting to assign to multiple groups:

 

Other error codes

These errors can also occure when attempting to assign records. Note that these are described in the person and group routes above:

 

 

Matching


The Matching Engine provides a method for evaluating the compatibility between individuals and groups within our system. Compatibility is quantified using a score ranging from 0 to 100. Detailed below are two endpoints:

  1. Match - This facilitates matching between a chosen source and target.
  2. Best Match - This fetches the most compatible groups or individuals for a given source.

 

Match


The Match function compares a single source to multiple targets, and generates an array of scores to indicate the level of compatibility between each source and target. source can be a single person, single group, or a an array of persons (what we usually refer to as "virtual group"). targets can be an array with combinations of groups, persons, or also a virtual groups.

The response includes an object with a results field, which contains an array representing the compatibility of each match. The scores are indexed in the same order as the targets array in the request.

 

 

Example request body

 

Response example: Returns matching score

 

Example 2 request body (source is an array of persons, i.e, "virtual group")

 

Response 2 example: Returns matching score

 

Example 3 request body (targets now also includes a virtual group, and a person)

 

Response 3 example: Returns matching score

 

Example request 4: The second unit happens to be empty

 

Example response 4: The response in case of a rejection

 

 

Best Match


The best match endpoint enables you to locate the best matching entity across the entire workspace for a specified source.

As you may have noted, there are no differences between resolved or rejected requests - best match will exclusively contain resolved matches. At most, 20 items will be included, but this may be fewer if the system currently lacks a sufficient number of individuals or groups available for matching.

 

Example request body

 

Response example: Returns best matching score for person to groups

 

Overlap handling


Overlap handling is implemented for all matching requests. It takes into account situations where some individuals appearing in the source also exist in the target entities. This may happen, for example, when matching an individual with a group in which they are already a member. The default procedure for managing such scenarios involves the following steps:

By applying these rules, the overlap handling ensures that the same person doesn't feature in both the source and target when a match is being calculated, thus maintaining the integrity of the matching process.

 

Match Error Codes


The error codes possible to get from the match endpoint are:

These are described in the person and group routes.

 

 

Throttling


In the context of the API, there's a throttler mechanism that enforces rate limits on the number of requests a client can make to ensure that the API remains responsive and available for all clients and to prevent one client from monopolizing the resources of the API.

When a client exceeds the rate limit, the API will return a 429 error to indicate that the client has exceeded its allowed number of requests. The client should wait a certain amount of time before retrying the request. The duration of the waiting time is included in the response headers in the form of the 'Retry-After' header.

 

 

Disclaimer


Please note that any data found on an object that is not explicitly mentioned in this document is not officially supported. Such values are susceptible to alterations at any time without prior notice.