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/admin/dependant/post


Request


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


Body  

minimum data requirements 

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
dependents[repeated]



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

typeId
nullable intthe type id of the dependant

salutationIdnullable intthe salutation id of the dependant

foreNames

stringthe forenames of the dependant


middleNames
stringthe middlenames of the dependant

surname
stringthe surname of the dependant

secondSurnamestringthe second surname of the dependant


dateOfBirth
Date
the 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
bool
indicates 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

The API Client requires write permission to "User Dependants" and access to the user(s) to successfully to perform post requests (See Admin User Roles for more details).  Only tenants 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/admin/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},\"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/admin/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},"allowDelete": {allowDelete},"requireDeleteDocument": requireDeleteDocument} }]}'