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 Behaviour 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 Replaces existing file fileA.pdf titleB 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://api.fundpress.io/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"
        }
    }
}

clientCode is a unique identifier for the document, a sort of primary key. If you send another doc with the same clientCode, it will be assumed as an update and will overwrite the content. A clientCode is required for documents that are sent with links instead of physical files. For those sent with physical files, it can be ommitted and the system will generate one based on the hash of the file + its associated data.

cultureCode is use to indicate 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 not inconsistent.

title is an optional field that can be used to describe the document in a more friendly way.

path is used for linked files - and should represent the URL path to their documents. Note that a file cannot be uploaded alongside a path or the call will fail.

meta is 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 previously. Note that meta data must be of a particular type, as specified in its in 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://api.fundpress.io/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://api.fundpress.io/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 websockets can be used to push multiple files in at once.

Parameter Value
End Point wss://api.fundpress.io/docloader/upsertDocument
Headers Kurtosys web socket init protocol
Content Type text

Initiating a web socket connection is as simple as connecting to the above end point using a web socket library in the language of your choice. An initiation handshake must be made, by sending a JSON message of the form 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 of the form:

{
    "status": "GO"
}

It is important not to send any more messages until the handshake response has been accepted. However, at this stage messages can be sent. The loader will wait until it has received totalRows messages over the line, 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 array.

The end point accepts messages similar to that of the /addDocumentNoFile end point. 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

File Extension
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