The intelliHR documents tab is commonly used to house all documentation that relates to a person’s employment - this can be anything from contracts of employment, signed policy documents and other HR documents. This article will help you understand the process of using the intelliHR public API to automatically upload people documents from other platforms into intelliHR.
This article covers:
Step 1: Find a Person
To begin, identify the person you’d like to upload a document for.
You can list all people from the public API, or locate a person Id from the path parameters of the person profile: https://{yourtenanturl}.intellihr.net/spa/people/5b84bbf6-a3a7-4d13-895e-d5eb79620dc9
Step 2: Uploading a Document
Create Presigned URL
POST to create a place in amazon for the document to be uploaded - this will return a temporary link which we can then use to instruct Amazon what to store there, parse the person Id in the path parameter.
"url": https://api.intellihr.io/v1/people/{personId}/documents
"method": 'POST'
"headers": {
"Content-Type": 'application/json',
"Accept": 'application/json',
"Authorization": `Bearer ${apikey}`,
"Tenant": tenantname
}
"body": {
"imageType": “PERSON_PROFILE”,
"extension": png
}
This will return the information you need in order to upload the file to the temporary Amazon S3 bucket.
💡 The file extension specified in the initial POST and the file extension of the
encoded file must match or S3 will throw a validation error.
Upload the Document to the Presigned URL
Upload the file to the temporary AWS S3 bucket by using the presignedUploadUrl
Send the file as binary and encode in base64 as below.
url: presigned.data.presignedUploadUrl,
method: 'PUT',
headers: {
'Content-Type': 'application/pdf'
},
body: new Buffer(Buffer.from(bundle.inputData.fileStream, 'base64'), 'binary')
}
In Postman, this would look something like this:
Encoding files will vary client to client, so you may need to consult documentation for your chosen client to identify the best way to upload the file.
PATCH to Promote Temporary Document
PATCH
the person documents endpoint to promote the temporary document.
personID
will relate to the person record you are uploading the document for.
id
is returned when the presignedUrl is created.
"url": 'https://api.intellihr.io/v1/people/{personId}/documents/{id}'
"method": 'PATCH'
"headers": {
"Content-Type": 'application/json',
"Accept": 'application/json',
"Authorization": `Bearer ${apikey}`,
"Tenant": tenantname
}
"body": {
"filename": "OfferLetter.pdf",
"uploadStatus": "SUCCESS"
}
This will promote the uploaded the document to the person’s profile.
💡 The file extension specified in the initial POST and the file extension of the encoded file must match or S3 will throw a validation error
Tip: For information on uploading people documents via the intelliHR API, contact your friendly intelliHR Integration Team! You can reach them at integrations@intellihr.com