All API end points are protected and you will need a bearer token to send to the end point before you will be permitted access.  To obtain a bearer token you will need to send a request to the following end point:


POST    /api/dependant/post


Request


The following form-urlencoded content needs to be sent in the request:


Body  

minimum data requirements 

IMPORTANT - if no dependants are sent in the request (one or many) it will be treated as a remove all dependants request.



userAccountId

int
the user account id of the employee
tenantId

intthe id of the tenant
tenantName

string
the name of the tenant
hasPersonDetails

boolthe requested user has a person details record
dependent



id
intthe id of the dependant (new set as 0 for a new dependant)

typeId
nullable intthe type id of the dependant

salutationIdnullable intthe salutation id of the dependant

foreNames

stringthe forenames of the dependant


middleNames
string
the middlenames of the dependant

surname
string
the surname of the dependant

secondSurnamestring
the second surname of the dependant


dateOfBirth
Datethe date of birth of the dependant. Example of date format "2009-04-08T00:00:00"

genderId
nullable intthe gender id of the dependant

registeredDisabled
boolindicated dependant is registered disabled if set to true

inFullTimeEducation
boolindicates dependant in full time education if set to true


See How to create API Clients to see how to obtain API Client IDs and secrets


Permissions

Only tenants/users that the API client has access to will be returned.



C# Example:


var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://{platform API url}/api/dependant/post");
var content = new StringContent("{\"userAccountId\": \"{userAccountId}\",\"tenantId\": \"{tenantId}\",\"tenantName\": \"{tenantName}\", \"dependants\": [ { \"id\": {id},\"typeId\": {typeId},\"salutationId\": {salutationId},\"forenames\": \"{foreNames}\",  \"middelNames\": {middleNames}, \"surname\": \"{surName}", \"dateOfBirth\": \"{dateOfBirth}", \"genderId\": {genderId}, \"registeredDisabled\":{registeredDisabled}, \"inFullTimeEducation\": {inFullTimeEducation},\"requireDocument\":{requireDocument },\"isDeleted\":{isDeleted}, \"allowDelete\":{allowDelete},  \"requireDeleteDocument\":{requireDeleteDocument]}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());


cURL Example


curl --location 'https://{platform API url}/api/dependant/post' \ --header 'Content-Type: application/json' \ --data-{"userAccountId": "{userAccountId}",    "tenantId": "{tenantId}","tenantName":"{tenantName}","dependants": [{ "id":{id},           "typeId": {typeId}, "salutationId": {salutationId}, "forenames": "{foreNames}",           "middlenames": "{middleNames}","surname": "{surname}","dateOfBirth": "{dateOfBirth}",         "genderId": {genderId},  "registeredDisabled": {registeredDisabled},"inFullTimeEducation":  {inFullTimeEducation}, "requireDocument" : {requireDocument} , "isDeleted" : {isDeleted}, "allowDelete" : {allowDelete}, "requireDeleteDocument" : {requireDeleteDocument
}]}'