Skip to end of metadata
Go to start of metadata

Downloading document information from the process

Path to servlet: api/documents/query

Method: GET

Parameters:

  • processId - Id of the process for which we want to download documents
  • activityId - (optional) Id of the task for which we want to download documents. If not specified, all documents from the process will be downloaded.

Answer:

  • The answer contains a list of documents.
Example answer
[
   {
      "id":2236,
      "documentClass":{
         "id":3281,
         "name":"xx",
         "description":"xx",
         "expiration":"",
         "expirationType":"on",
         "directory":null,
         "encoding":true,
         "compressing":false,
         "ftsServerId":null,
         "cipherAlgorithm":"AES",
         "keyLength":128,
         "orderId":6,
         "indexPath":"C:\\temp\\qq\\\\k\\indexDir_3281",
         "indexing":false,
         "files":null,
         "actions":null,
         "indexes":null,
         "linkConnections":null,
         "expirationDate":null
      },
      "description":"xx",
      "compressed":false,
      "encrypted":true,
      "cipherAlgorithm":"AES",
      "cipherKey":"-72,-27,-19,-29,-27,87,-47,112,19,-55,-37,-21,-112,-13,-128,21",
      "fileName":"PIARedist.exe",
      "systemFileName":"IMG7882392016468885022.exe",
      "fileDate":1391771512507,
      "path":"C:\\temp\\qq\\k\\",
      "uploader":"admin",
      "size":6876816,
      "version":{
         "file":null,
         "parentFile":null,
         "newestFile":null,
         "checkOutDate":null,
         "checkInDate":1391727600000,
         "replaceDate":null,
         "checkOutUserName":"admin",
         "state":"STATE_READY",
         "comment":null,
         "version":1,
         "id":2236,
         "activityDocuments":null
      },
      "activityDocuments":null,
      "fullPath":"C:\\temp\\qq\\k\\/IMG7882392016468885022.exe"
   }
]

Downloading extended document information from the process

Path to servlet: api/documents/view/query

Method: GET

Parameters:

  • processId - Id of the process for which we want to download documents
  • activityId - (optional) Id of the task for which we want to download documents. If not specified, all documents from the process will be downloaded.

Answer:

  • The answer contains a list of documents.

 

Example answer
[
   {
      "file":{
         "id":2236,
         "documentClass":{
            "id":3281,
            "name":"xx",
            "description":"xx",
            "expiration":"",
            "expirationType":"on",
            "directory":null,
            "encoding":true,
            "compressing":false,
            "ftsServerId":null,
            "cipherAlgorithm":"AES",
            "keyLength":128,
            "orderId":6,
            "indexPath":"C:\\temp\\qq\\\\k\\indexDir_3281",
            "indexing":false,
            "files":null,
            "actions":null,
            "indexes":null,
            "linkConnections":null,
            "expirationDate":null
         },
         "description":"xx",
         "compressed":false,
         "encrypted":true,
         "cipherAlgorithm":"AES",
         "cipherKey":"-72,-27,-19,-29,-27,87,-47,112,19,-55,-37,-21,-112,-13,-128,21",
         "fileName":"PIARedist.exe",
         "systemFileName":"IMG7882392016468885022.exe",
         "fileDate":1391771512507,
         "path":"C:\\temp\\qq\\k\\",
         "uploader":"admin",
         "size":6876816,
         "version":{
            "file":null,
            "parentFile":null,
            "newestFile":null,
            "checkOutDate":null,
            "checkInDate":1391727600000,
            "replaceDate":null,
            "checkOutUserName":"admin",
            "state":"STATE_READY",
            "comment":null,
            "version":1,
            "id":2236,
            "activityDocuments":null
         },
         "activityDocuments":null,
         "fullPath":"C:\\temp\\qq\\k\\/IMG7882392016468885022.exe"
      },
      "actions":[
         "SHOW",
         "DETACH",
         "CHANGE"
      ]
   }
]

 

Download available document classes

Path to servlet: api/documents/classes

MethodGET

Parameters:

  • rightType - type of rights to add documents to the system, one of:
    • ALL - to process or archive,
    • PROCESS - to process
    • ARCHIVE - to archive
Answer:
  • The answer contains a list of document classes to which the logged-in user has permissions.

Downloading indexes for a class of documents

Path to servlet: api/documents/indexes/{documentClassId}

Metoda: GET

Parameters:

  • documentClassId - Id of document class (parameter passed in servlet path)

Answer:

  • The answer contains a list of indexes.

Add document

Path to servlet: api/documents/upload

MethodPOST

enctypemultipart/form-data

Parameters

  • indexesAsJson (from version 4.0.39) - (optional, true/false) indexes are transferred in JSON format (form indexesJson field)

Query Content:

HTML form containing the definition of the document. The definition should contain the following field:

    • file - field type file 
    • activityId - task Id
    • processId - process Id
    • documentClassId - document class Id
    • description - description
    • newVersion - (true/false) Save as a new version
    • indexes - (optional) Index values of the document to be added. The values should be transferred according to the form-data request type, i.e. in the form of

      An example of a valid value for the indexes field
      indexes[1]: "Index value with id 1"
      indexes[3]: "Index value with id3"
    • indexesJson (from version 4.0.39) - (optional, to be specified in combination with the query parameter indexesAsJson=true) Index values of the added document. The values should be passed in JSON format:

      An example of a valid value for the indexesJson field
      {
      	"1": "Index value with id 1",
      	"3": "Index value with id 3",
      	"11": 234.62, /* Floating point index value with id 11*/
      	"15": false /*Boolean index value with id 15*/
      }
    Example of the content of a query from POSTMAN
    POST /PlusWorkflow/api/documents/upload HTTP/1.1
    Host: localhost:8080
    Cache-Control: no-cache
    Postman-Token: 4ab6c224-0ea3-9ecc-c8ac-a4823501a54b
    Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
    ------WebKitFormBoundary7MA4YWxkTrZu0gW
    Content-Disposition: form-data; name="file"; filename="Nowy dokument tekstowy.txt"
    Content-Type: text/plain
    
    ------WebKitFormBoundary7MA4YWxkTrZu0gW
    Content-Disposition: form-data; name="documentClassId"
    1
    ------WebKitFormBoundary7MA4YWxkTrZu0gW
    Content-Disposition: form-data; name="newVersion"
    false
    ------WebKitFormBoundary7MA4YWxkTrZu0gW
    Content-Disposition: form-data; name="indexes[1]"
    wartosc indeksu o id 1
    ------WebKitFormBoundary7MA4YWxkTrZu0gW
    Content-Disposition: form-data; name="indexes[3]"
    wartosc indeksu o id 3
    ------WebKitFormBoundary7MA4YWxkTrZu0gW--

The parameters activityId and processId are optional:

    • If we specify both parameters, the document will be added to the archive and connected to the indicated task.

    • If we specify only processId, the document will be added to the archive and connected to the indicated process.

    • If we specify neither parameter or specify only activityId, the document will be added to the archive only.

Answer:

  • The answer contains the definition of the saved file

 

Example of a form for adding a document
Ext4.widget('window',{
    title:'Nowy dokument',
    width:500,
    height:300,
    autoShow:true,
    items:[
        {
            xtype:'form',
            items:[
                {
                    xtype:'fileuploadfield',
                    name:'file'
                },{
                    xtype:'textfield',
                    value:3,
                    name:'documentClassId'
                },{
                    xtype:'textfield',
                    value:processId,
                    name:'processId'
                },{
                    xtype:'textfield',
                    value:activityId,
                    name:'activityId'
                },{
                    xtype:'textfield',
                    value:123,
                    name:'indexes[1]'//index id from database
                },{
                    xtype:'textfield',
                    value:'wartosc',
                    name:'indexes[4]'//index id from database
                }
            ]
        }
    
    ],
    buttons:[
        {
            text:'Zapisz',
            handler:function(){
                var form=this.up('window').down('form').getForm();
                form.submit({
                    url:'api/documents/upload'
                });
            }
        }
    ]
});

Internet Explorer support

In Internet Explorer, in order to perform a file upload, the server must respond with a Content-Type: text/html header. You should then call the request with an additional parameter:

responseAsHtml - true forces the Content-Type header to be set to text/html

Download document

Path to servlet: api/documents/download/{fileId}

MethodGET

Parameters:

  • fileId - Id of the file you want to download (parameter passed in the servlet path)

Answer:

  • Data stream with file
  • HTTP status: OK or UNAUTHORIZED

Get document

 Path to servlet: api/documents/get/{filename}

 Method: GET

Parameters:

  • filename - file name with extension (passed in servlet path)
  • fileId - file Id
  • processId - (optional) Id of the process for which we want to download documents
  • activityId - (optional) Id of the task for which we want to download documents

Note, the system parameter 'AuthorizeUserForFile' determines whether user authorization is required for this servlet.

Answer: downloaded document file.

Download information about connected documents to a job

Path to servlet: api/documents/activity

Method: GET

Parameters:

  • processId - Id of the process for which we want to download documents
  • activityId - Id of the task for which we want to download documents

Answer: Information about the documents, i.e. besides the files, also additional information about the document, e.g. by whom it was connected to the archive and by whom it was connected to the process, etc.

Disconnecting a document from a process

Path to servlet: api/documents/{fileId}/{processId}

Method: DELETE

Parameters:

  • fileId - Id of the file we want to download ( parameter passed in the servlet path)
  • processId - Id of the process from which we are detaching the file

Answer:

  • no answer

Delete document (from version 3.1.31)

The method removes the file from the system. If the file to be deleted is version ex: 2, and the whole document is version 5, then all versions upwards will be deleted, i.e. only version 1 file will be left, unless the parameter {@code deleteAllVersions=true}, then all versions will be deleted.

The user must have permission to delete this file.

Path to servlet: api/documents/{fileId}

MethodDELETE

Parameters:

  • fileId - Id of the file you want to delete (parameter passed in the servlet path)
  • deleteAllVersions (optional - default false) - Specifies whether all previous versions of this document are also to be deleted.

Answer:

  • no answer

Change of document index values (from version 3.1.31)

The method changes the transferred index values in the specified document. The user must have permission to modify the document.

Path to servlet: api/documents/{fileId}/indexes

MethodPUT

Request Content-Typeapplication/json

Parameters:

  • fileId - Id of the file whose indexes we want to change (parameter passed in the servlet path)

  • indexes - JSON object containing the indexes to be changed:
Example of index transfer
{
	"2":"New index value with id 2",
	"7":New index value with id7",
	"11":234.62 /* New floating point index value with id 11 */
} 

Answer:

  • no answer

Search for documents based on filters (from version 3.1.31)

The method searches for documents based on the specified filters. User rights are taken into account. You can search by document class (the id of the document class must be specified in the documentClassId parameter) or document set (the id of the document set must be specified in the documentSetId parameter). You cannot search by document class and document set at the same time (only one parameter can be completed). Currently, the indexes of the document class/document set are still an additional filter. If you do not specify indexes, all documents from the specified document class/document set will be searched. 

Path to servlet: api/documents/query

MethodPOST

Request Content-Typeapplication/json

Parameters:

  • JSON object contains filters

    Example of index transfer
    {
    	"documentClassId": 1, //document class id 
    	//lub
    	"documentSetId": 3, //sets of documents id
    	
    	"indexes": { //document indexes
    		"2":"Index value with id 2",
    		"7":"Index value with id  7",
    		"11":234.62 /* Floting point index value with id 11 */
    		"148": { //version 4.1.16: range search by index
                "from": 2023-12-01 17:10:00
                "to" : 2023-12-05
            }
    	}
    	"fromDate": "2023-09-07", // version 4.1.6: lower search bound by document addition
        "endDate": "2023-09-07 12:08" // version 4.1.6: upper search bound by document addition
    } 

Answer:

  • List of searched documents
Example answer
[
   {
      "documentId":81,
      "fileId":110,
      "documentClassId":1,
      "indexes":[
         {
            "id":17,
            "name":"Data",
            "value":"2016-02-25",
            "type":"DATE"
         },
         {
            "id":16,
            "name":"Wartość",
            "value":1,
            "type":"LONG"
         },
         {
            "id":7,
            "name":"Opis",
            "value":"To jest opis",
            "type":"STRING"
         },
         {
            "id":8,
            "name":"Uwagi",
            "value":null,
            "type":"STRING"
         }
      ]
   }
]

Get all versions of the file

Path to servlet: api/documents/{fileId}/versions

MethodGET

Parameters:

  • fileId - Id of the file for which we want to download all versions( parameter passed in servlet path)

Answer:

  • List of searched documents
Example answer
[
   {
        "id": 201,
        "documentClass": null,
        "description": "opis",
        "compressed": false,
        "encrypted": false,
        "cipherAlgorithm": null,
        "cipherKey": null,
        "fileName": "file1.txt",
        "systemFileName": "IMG2940464874411094485.txt",
        "fileDate": 1560167912486,
        "path": "C:\\Temp\\Urządzenia\\Katalog1\\",
        "uploader": "admin",
        "size": 31,
        "version": {
            "file": null,
            "parentFile": null,
            "newestFile": null,
            "checkOutDate": 1560808800000,
            "checkInDate": 1560117600000,
            "replaceDate": 1560808800000,
            "checkOutUserName": "admin",
            "state": "STATE_EDIT",
            "comment": null,
            "version": 1,
            "id": 201,
            "activityDocuments": null
        },
        "activityDocuments": null
    },
    {
        "id": 212,
        "documentClass": null,
        "description": "opis2",
        "compressed": false,
        "encrypted": false,
        "cipherAlgorithm": null,
        "cipherKey": null,
        "fileName": "file2.txt",
        "systemFileName": "IMG859030577728292225.txt",
        "fileDate": 1560864125553,
        "path": "C:\\Temp\\Urządzenia\\Katalog1\\",
        "uploader": "admin",
        "size": 33,
        "version": {
            "file": null,
            "parentFile": null,
            "newestFile": null,
            "checkOutDate": 1560895200000,
            "checkInDate": 1560808800000,
            "replaceDate": 1560895200000,
            "checkOutUserName": "admin",
            "state": "STATE_EDIT",
            "comment": "",
            "version": 2,
            "id": 212,
            "activityDocuments": null
        },
        "activityDocuments": null
    }
]
 

Changes the data in the database regarding the downloaded document

Changes the data in the database regarding the downloaded document to be changed. Sets the appropriate status, date of downloading the document, and downloading user.

Path to servlet: api/documents/{fileId}/checkOut

MethodPUT

Parameters:

  • fileId- file id (parameter transferred in servlet path)

Answer:

  • Relevant HTTPStatus: OK, CONFLICT or FORBIDDEN

Cancels making changes to a downloaded document

Cancels making changes to a document. Sets the appropriate status, resets the date the document was downloaded, and the downloading user.

Path to servlet: api/documents/{fileId}/undoCheckOut

MethodPUT

Parameters:

  • fileId - file id (parameter transferred in servlet path)

Answer:

  • Relevant HTTPStatus: OK or CONFLICT

Saves a new version of the file

Saves a new version of the file we previously downloaded to change.

Path to servlet: api/documents/checkIn

MethodPOST

enctypemultipart/form-data

Query Content:

HTML form containing the definition of the document. The definition should contain the following field:

    • file - File type f file 
    • description - Description
    • parentFileId - id of the file we are updating
    • comment - comment
    Example of the content of a query from POSTMAN
    POST /PlusWorkflow/api/documents/checkIn HTTP/1.1
    Host: localhost:8080
    Authorization: Basic YWRtaW46ZW5oeWRyYQ==
    Cache-Control: no-cache
    Postman-Token: 201b80af-904e-de34-2678-c476fda6d348
    Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
    ------WebKitFormBoundary7MA4YWxkTrZu0gW
    Content-Disposition: form-data; name="file"; filename="x6.docx"
    Content-Type: 
    
    ------WebKitFormBoundary7MA4YWxkTrZu0gW
    Content-Disposition: form-data; name="parentFileId"
    179
    ------WebKitFormBoundary7MA4YWxkTrZu0gW
    Content-Disposition: form-data; name="comment"
    my comment
    ------WebKitFormBoundary7MA4YWxkTrZu0gW--

Answer:

  • The response contains the id of the saved file in case of a valid save or the content of the error depending on the returned response status.

Download the current status of a document

Path to servlet: api/documents/{fileId}/status

MethodGET

Parameters:

  • fileId - file Id

Answer:

  • Current document status.
Example answer
"STATE_READY"

  • No labels