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

Adds a new relationship to the client in a client web enrolment.

C#
[WebMethod(Description = "Adds a relationship for a web client")]
public TAuthID AddWebClientRelationship(string token, int webEnrolId, TClieRelationship clieRelationship);
Parameters 
Description 
string token 
String containing an authentication token. 
int webEnrolId 
Integer ID of the web enrolment to add the relationship to. 
TClieRelationship clieRelationship 
TClieRelationship containing the client relationship details to add. 

TAuthID containing the ID of the new (temporary) web client relationship.

The webEnrolId parameter must be the ID of an existing web enrolment, which was returned from AddClientWebEnrolment. The client enrolling in this web enrolment will be the client that 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, to further define the relationship. Each relationship type has a separately configured list. Refer to GetRelationshipTypes for a list.
  • RelationName: Ignored
  • StartDate: Ignored
  • EndDate: Ignored
  • 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 will be used to update that existing client. If this is blank, when the web enrolment is processed, if no existing matching client is found, a new client will be created, using the other fields - thus if ClientCode is blank, Surname is mandatory, and at least one of Email, MobilePhone or HomePhone is mandatory.
  • GivenName: Given name of "to" client. Only used if ClientCode is blank, to create a new client when the web enrolment is processed. 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 if it is empty in the matched client. 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 when the web enrolment is processed. If there's one existing client with the matching name and specified contact details, that existing client will be attached to the relationship, instead of creating a new client, and any new contact details updated. 

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

When processing the web enrolment, if the web client and "to" client are matched to existing clients, and the relationship already exists, a duplicate relationship is not created. 

A TAuthID is returned - if successful, it contains the ID of the new (temporary) web 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.