ASP.NET VETtrak API web services
ContentsIndexHome
PreviousUpNext
VT_API.AddClientRelationship Method

Adds a new relationship to a client.

C#
[WebMethod(Description = "Adds a relationship for a client")]
public TAuthID AddClientRelationship(string token, string clientCode, TClieRelationship clieRelationship);
Parameters 
Description 
string token 
String containing an authentication token. 
string clientCode 
String containing the code of the client to add the relationship to. 
TClieRelationship clieRelationship 
TClieRelationship containing the client relationship details to add. 

TAuthID containing the ID of the new client relationship.

The clientCode parameter must be the code of an existing client, indicating the client the new relationship is "from". 

The clieRelationship parameter is a TClieRelationship containing details of the new relationship. Properties are:

  • ClieRelationshipId: Ignored
  • RelationshipTypeCode: Mandatory code of the relationship type. Refer to GetRelationshipTypes for a list. All databases have "EC" for Emergency Contact, and "G" for Parent/Guardian.
  • RelationshipTypeName: Ignored
  • RelationId: Optional ID of the relation. Each relationship type has a separately configured list. Refer to GetRelationshipTypes for a list.
  • RelationName: Ignored
  • StartDate: Optional start date of relationship.
  • EndDate: Optional end date of relationship.
  • Description: Optional description of relationship.
  • ToClient: Mandatory TRelationshipToClient containing details of the client that the relationship is "to".
 

The ToClient property is a TRelationshipToClient object with the following properties:

  • ClientCode: Specify the code of an existing client to attach that existing client to the relationship, and if any of the contact detail fields are specified, they are used to update that existing client. If this is blank, a new client will be created, using the other fields - in this case, Surname is mandatory, and at least one of Email, MobilePhone or HomePhone is mandatory. Cannot be the same as the "from" client.
  • GivenName: Given name of "to" client. Only used if ClientCode is blank, to create a new client. Leave blank for a single name client.
  • Surname: Surname, or single name, of "to" client. Only used if ClientCode is blank, in which case this is mandatory.
  • OtherNames: Optional other names of "to" client. If specified, will be used to add or update. Leave blank for a single name client.
  • Email: Optional email address of "to" client. If specified, will be used to add or update.
  • MobilePhone: Optional mobile phone number of "to" client. If specified, will be used to add or update.
  • HomePhone: Optional home phone number of "to" client. If specified, will be used to add or update.
 

When creating a new "to" client, an automatic data match will be performed. If there's one existing client with the matching name and contact details, that existing client will be attached to the relationship, instead of creating a new client. 

If a new client is created for the "to" client, it will not be able to login by default. 

If the client relationship already exists, a duplicate is not created. 

A TAuthID is returned - if successful, it contains the ID of the new client relationship record. 

A token is passed for authentication. If the authentication fails, or other errors occur, no ID is returned. The result of the authentication is represented by a TAuthenticate object. 

This function has security level "Protected", and can only be accessed by users that have explicitly been granted permission to the API.

Copyright (c) VETtrak 2022. All rights reserved.