Document Uploader Service

The document uploader service allows for the upload of physical documents as well as document links. It accepts both https, post (multipart/formdata & JSON/base64 file) and web socket connections (json/base64 file). See the bottom of this document for a list of all allowed file extensions.

Expected Behavior when uploading a file

Adding files with different titles

Match No match Match
Expected Outcome Original Name Title Hashed File
Action 1 Add new file fileA.pdf titleA 12345
Action 2 Add new file fileA.pdf titleB 12345

Adding files with different filenames

No match Match Match
Expected Outcome Original Name Title Hashed File
Action 1 Add new file fileA.pdf titleA 12345
Action 2 Add new file fileB.pdf titleA 12345

Adding files with different content based hash

Match Match No match
Expected Outcome Original Name Title Hashed File
Action 1 Add new file fileA.pdf titleA 12345
Action 2 Add new file fileA.pdf titleA abcde

Adding files with same filename, title and content based hash

Match Match Match
Expected Outcome Original Name Title Hashed File
Action 1 Add new file fileA.pdf titleA 12345
Action 2 Replace existing file fileA.pdf titleA 12345

Uploading a Linked File

The simplest method of registering a document in the system is via an external link. However, many of the fields are the same when uploading a physical file.

Parameter Value
End Point https://<US: api-us.kurtosys.app OR UK: api-uk.kurtosys.app>/docloader/addDocumentNoFile
Headers X-KSYS-TOKEN
Content Type application/json
HTTP Method POST
{
    "clientCode": "testDoc2",
    "cultureCode": "en-GB",
    "title": "China Select FactSheet Individual",
    "path": "http://www.myassetmanager.com/factsheet.pdf",
    "meta": {
        "doctype":{
            "value":"FactSheet"
        }
    }
}
Value Description
clientCode A unique identifier for a document, a primary key. If you send another doc with the same clientCode, it will be assumed to be an update and will overwrite the original. A clientCode is required for documents that are sent with links instead of physical files. For those sent with physical files, it can be omitted and the system will generate one based on the hash of the file and its associated data
cultureCode Indicates the language and target country of the file. This is a free form field and is not enforced, so it is up to the user to ensure that the cultureCode is correct and consistent
title An optional field that can be used to describe the document in a more friendly way
path Used for linked files, should represent the URL path to the documents. Note: a file cannot be uploaded alongside a path or the call will fail
meta A complex object containing tags for the document. Each key must be added to the system as a piece of document meta data. In the above example the doctype key will have been added. Note: Meta data must be of a particular type as specified in its meta data definition, else it will fail

Uploading a File Via multipart/form-data

The above details apply to uploading a document and including a file, except that the fields need to be passed as form variables. The one key difference is that a file must be passed instead of a path.

Parameter Value
End Point https://<US: api-us.kurtosys.app OR UK: api-uk.kurtosys.app>/docloader/addDocument
Headers X-KSYS-TOKEN
Content Type multipart/form-data
HTTP Method POST

Uploading a File using a Base64 encoded file

The above details apply to uploading a document and including a file, the file will need to be base64 encoded and supplied with the body of the request.

Parameter Value
End Point https://<US: api-us.kurtosys.app OR UK: api-uk.kurtosys.app>/docloader/upsertDocument
Headers X-KSYS-TOKEN
Content Type application/json
HTTP Method POST
{
    "clientCode": "china_select_individual_fs",
    "cultureCode": "en-GB",
    "title": "China Select FactSheet Individual",
    "file": "< BASE 64 ENCODED FILE >",
    "originalname": "China_Select_Individual_Factsheet.pdf",
    "meta": {
        "doctype":{
            "value":["FactSheet"]
        }
    }
}

Note that the originalname is required for this call.

Uploading a File Via Websocket

If a bulk load of files is required the websocket can be used to push multiple files at once.

Parameter Value
End Point wss://<US: api-us.kurtosys.app OR UK: api-uk.kurtosys.app>/docloader/upsertDocument
Headers Kurtosys websocket initiation protocol
Content Type text

Initiating a websocket connection is as simple as connecting to the above endpoint using a websocket library in the language of your choice. An initiation handshake must be made by sending a JSON message as below:

{
    "token": <INSERT TOKEN HERE>,
    "entityType": "document",
    "totalRows": <INSERT TOTAL NUMBER OF DOCUMENTS HERE>
}

This should be the first message sent. If the handshake is successful then a response message will be sent as:

{
    "status": "GO"
}

It is important not to send any more messages until the handshake response has been accepted, only then can messages be sent. The loader will wait until it has received totalRows messages before invoking its loading function.

When done it will respond with an object of the form:

{
    "status": "FINISHED",
    "failures": "[<LIST OF FAILED ITEMS>]"
}

Any failures and their associated error messages will be in the failures string array.

The endpoint accepts messages similar to that of the /addDocumentNoFile endpoint. However, the wss method also accepts documents as base64 encoded strings.

{
    "clientCode": "testDoc2",
    "cultureCode": "en-GB",
    "title": "China Select FactSheet Individual",
    "file": <DOCUMENT AS BASE64 ENCODED STRING>,
    "meta": {
        "doctype": {
            "value": "FactSheet"
        }
    }
}

Allowed File Extensions

3ds 3g2 3gp 3gpp 7z aac ace ai aif aifc
aiff apk asf asx au avi bin bmp bz bz2
cab cer com crt crx css csv deb der dll
doc docm docx dot dotm dotx eml eps epub exe
f4v flac fli flv fpx gif gtar gz hqx htm
html ico ics jar jnlp jp2 jpe jpeg jpf jpg
jpx js json kar lha lzh m2v m3u m3u8 m4a
m4v mid midi mov mp3 mp4 mpe mpeg mpg mpg4
mpga mxf odb odc odf odg odi odm odp ods
odt oga ogg ogv otg oth oti otp ots ott
p12 p7c p7m p7s pct pdf pem pfx php pic
pkpass pl pls pm png potm potx pps ppsm ppsx
ppt pptm pptx ps psd qt ra ram rar rdf
rm rmp rmvb rpm rss rtf sda sdc sdd sdp
sdw sea sgi sh shtml sit sitx smf smi smil
snd stc std sti stw svg svgz swf sxc sxd
sxg sxi sxm sxw tar text tga thmx tif tiff
tsv txt uu vcard vcf vcs wasm wav wax webm
webp wm wma wmv wmx woff wvx xbm xht xhtml
xlam xlsb xlsm xlsx xltm xltx xml xsl xslt xul
xz ymp zip

Uploading with Document expiry

Include an expires property to set the expires field within the data base. This field is used to determine if the document has expired. If the expires property is not supplied, then the default value of 0000-00-00 00:00:00 will be save and cause the system to consider that the document does not expire.

Parameter Value
End Point https://<US: api-us.kurtosys.app OR UK: api-uk.kurtosys.app>/docloader/addDocumentNoFile
Headers X-KSYS-TOKEN
Content Type application/json
HTTP Method POST
{
    "clientCode": "testDoc2",
    "cultureCode": "en-GB",
    "title": "China Select FactSheet Individual",
    "path": "http://www.myassetmanager.com/factsheet.pdf",
    "meta": {
        "doctype":{
            "value":"FactSheet"
        }
    },
    "expires": "2022-12-01"
}

Updating Document Meta

Update the meta for a document

Parameter Value
End Point https://<US: api-us.kurtosys.app OR UK: api-uk.kurtosys.app>/docloader/updateDocumentMeta
Headers X-KSYS-TOKEN
Content Type application/json
HTTP Method POST
{
    "clientCode": "80e2a0e762993542db7f028e014f2e16777e576f",
    "cultureCode": "en-GB",
    "title": "Test",
    "meta": {
        "abc": { "value": "foo" },
        "xyz": { "value": "bar" },
        "asd": { "value": ["yu", "me", "tu"] }
    }
}
Value Required Allowed Characters Description
clientCode yes not <>{}^=+@ A unique identifier for a document
cultureCode yes not <>{}^=+@ Indicates the language and target country
title yes not <>{}^=+@ Title of the document
meta yes not <>" A complex object containing tags for the document. Each key must be added to the system as a piece of document meta data
path no alphanumeric characters and ./():~- Used for linked files, should represent the URL path to the documents. Note: a file cannot be uploaded alongside a path or the call will fail