Relations in Mplus can be persons or companies. For example, customers are relations, but so are suppliers and other companies you do business with.


getRelations Getting a list of all relations

Use this function to get a complete or partial list of all available relations.
You can use the array relationNumbers to limit the results to specific relations.
You can specify a syncMarker to limit the results to changes since a certain moment.
Learn more about sync markers here.

getRelation Retrieving an existing relation

If you happen to already know the number of an existing relation, you can use that to retrieve the data of that relation.

findRelation Finding an existing relation

Before you create new relations in an Mplus database, it might be wise to check whether or not a relation with your data already exists. This way, you can reuse or update an existing relation. You can do this using the API function findRelation. The search terms are all optional and also case-insensitive. They will also match partially, so ‘john d’ will match ‘John Doe’.

createRelation Creating a new relation

If an existing relation is not found, you can create a new relation. The following example shows the findRelation function followed up with the createRelation function.

updateRelation Updating an existing relation

If you know a relation already exists, and you have its relation number, you can update the existing relation instead of creating a new one. The syntax to updating a relation is very similar to finding a relation.

adjustPoints Adjust points of a relation

Best Practices
How to keep your application up to date with the latest data

The best way to keep your application up to date with our relations is through the use of the syncMarker property.

How you ask? When your application runs for the first time you call getRelations with a syncMarker of 0. This will return a list of relations from the API (for a maximum of 1000 at a time).

You then start processing the list and each time you do you save the highest syncMarker that was processed. For your next run you take the syncMarker that you saved, increment its value with 1 and use that for your next call to getRelations.

When relations are changed on our side, its syncMarker gets updated. Therefore, if you use this method, you will only receive a list of all the changed relations. This makes for a faster and more efficient synchronization process.

Learn more about Sync Markers here.