The KGS Document Router is capable of accepting data over HTTP(S). In case the customer wishes to send data over HTTPS, this must be handled by the customer. The webserver (i.e. Apache Tomcat) needs to be enbled with HTTPS for the KGS DocumentRouter to handle requests via HTTPS.
The data is transferred as HTTP-POST and with multipart/form-data body. The document header information is transferred in the URL. One or more components are transferred by the body. This version of the function is particularly suitable for transferring documents consisting of several components into the content repository via the KGS DocumentRouter as a whole. The component information is specified in the header of each part the data in the body.
The request body is in multipart/form-data format. With this format, it is possible to transfer several independent parts to the KGS DocumentRouter. The individual parts have their header and a body
and are in MIME format (RFC 2045, 2046). This MIME format enables several components to be transferred to the KGS DocumentRouter simultaneously.
The result will be an JSON output depicting which parts are uploaded with which result. So an multi response is given while the http response code will be 201 (created) if all uploads where successfully.
Responses
HTTP response code | Body |
---|---|
201 | Json with separate response codes for every part (should be 201) Example: [ { "statuscode": 201, "message": "" }, { "statuscode": 201, "message": "" } ] |
400 | Json with separate response codes for every part. Example: [ { "statuscode": 400, "message": "Content repository TS is not defined : com.software.kgs.plugin.documentrouter.exception.DocArchivingException: Content repository TS is not defined" }, { "statuscode": 400, "message": "Content repository TS is not defined : com.software.kgs.plugin.documentrouter.exception.DocArchivingException: Content repository TS is not defined" } ] |
503 | Json with error message. Example: { "statuscode": 503, "message": "DR instance IndexFileBased not running." } |
Example
Upload-URL: POST http://localhost:8080/KGSAdmin-DR/documentrouter?create&instanceName=DR_Instance_name
Example sending 1 Document
A document consisting of one or more components is transferred in multipart/form-data format. The following example demonstrates sending a single document:
Document header
Content-Type:multipart/form-data;boundary= A495ukjfasdfddrg4hztzu898aA0jklm
...somemoreheaderinformation...
Content-Length:32413
Content part
--A495ukjfasdfddrg4hztzu898aA0jklm
Content-Disposition: form-data; filename="File_to_be_archived.pdf"
X-compId:data
Content-Type:application/pdf
Content-Length:4242
...4242BytesData...
--A495ukjfasdfddrg4hztzu898aA0jklm--
Example sending 2 documents
Document header
Content-Type:multipart/form-data;boundary= A495ukjfasdfddrg4hztzu898aA0jklm
...somemoreheaderinformation...
Content-Length:32413
Content part
--A495ukjfasdfddrg4hztzu898aA0jklm
Content-Disposition: form-data; filename="test_file.txt"
X-compId: index
Content-Type: text/plain
Content-Length: 7
…7BytesData…
--A495ukjfasdfddrg4hztzu898aA0jklm
Content-Disposition: form-data; filename="test_file.pdf"
X-compId:data1
Content-Type:application/pdf
Content-Length:4242
...4242BytesData...
--A495ukjfasdfddrg4hztzu898aA0jklm--
The KGS DocumentRouter should reply with HTTP code 201 in case the archiving was successful.