Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Polish

Pobieranie informacji o dokumentach z procesu

Ścieżka do servletu: api/documents/query

Metoda: GET

Parametry:

  • processId - Id procesu dla którego chcemy pobrać dokumenty
  • activityId - (opcjonalny) Id zadania dla którego chcemy pobrać dokumenty. Jeżeli nie podano, pobrane zostaną wszystkie dokumenty z procesu.

Odpowiedź:

  • Odpowiedź zawiera listę dokumentów.
Code Block
languagejavascript
titlePrzykładowa odpowiedź
linenumberstrue
collapsetrue
[
   {
      "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"
   }
]

Pobieranie rozszerzonych informacji o dokumentach z procesu

Ścieżka do servletu: api/documents/view/query

Metoda: GET

Parametry:

  • processId - Id procesu dla którego chcemy pobrać dokumenty
  • activityId - (opcjonalny) Id zadania dla którego chcemy pobrać dokumenty. Jeżeli nie podano, pobrane zostaną wszystkie dokumenty z procesu.

Odpowiedź:

  • Odpowiedź zawiera listę dokumentów.

 

Code Block
languagejavascript
titlePrzykładowa odpowiedź
linenumberstrue
collapsetrue
[
   {
      "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"
      ]
   }
]

 

Pobranie dostępnych klas dokumentów

Ścieżka do servletu: api/documents/classes

Metoda: GET

Parametry:

  • rightType - typ uprawnień do dodawania dokumentów do systemu, jeden z:
    • ALL - do procesu lub archiwum,
    • PROCESS - do procesu,
    • ARCHIVE - do archiwum.

Odpowiedź:

  • Odpowiedź zawiera listę klas dokumentów do których zalogowany użytkownik ma uprawnienia.

Pobieranie indeksów dla klasy dokumentów

Ścieżka do servletu: api/documents/indexes/{documentClassId}

Metoda: GET

Parametry:

  • documentClassId - Id klasy dokuementów( parametr przekazany w ścieżce servlet'u) 

Odpowiedź:

  • Odpowiedź zawiera listę indeksów.

Dodanie dokumentu

Ścieżka do servletu: api/documents/upload

Metoda: POST

enctypemultipart/form-data

Parametry:

  • indexesAsJson (od wersji 4.0.39) - (opcjonalny, true/false) Czy indeksy przekazywane są w formacie JSON (pole indexesJson formularza)

Treść zapytania:

Formularz HTML zawierający definicję dokumentu. Definicja powinna zawierać następujące pole:

    • file - Pole typu file 
    • activityId - Id zadania
    • processId - Id procesu
    • documentClassId - Id klasy dokumentów
    • description - Opis
    • newVersion - (true/false) Czy zapisać jako nowa wersja
    • indexes - (opcjonalny) Wartości indeksów dodawanego dokumentu. Wartości powinny być przekazane zgodnie z typem żądania form-data, czyli w formie

      Code Block
      languagejs
      titlePrzykład prawidłowej wartości pola indexes
      indexes[1]: "Wartość indeksu o id 1"
      indexes[3]: "Wartość indeksu o id 3"
    • indexesJson (od wersji 4.0.39) - (opcjonalny, należy go podawać w połączeniu z parametrem zapytania indexesAsJson=true) Wartości indeksów dodawanego dokumentu. Wartości powinny być przekazane w formacie JSON:

      Code Block
      languagejs
      titlePrzykład prawidłowej wartości pola indexesJson
      {
      	"1": "Wartość indeksu o id 1",
      	"3": "Wartość indeksu o id 3",
      	"11": 234.62, /* Wartość indeksu zmiennoprzecinkowego o id 11 */
      	"15": false /* Wartość indeksu logicznego o id 15 */
      }
    Code Block
    titlePrzykładowa treść zapytania z programu POSTMAN
    collapsetrue
    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--

Parametry activityId i processId są opcjonalne:

    • Jeżeli podamy oba parametry, to dokument zostanie dodany do archiwum i podłączony do wskazanego zadania.
    • Jeżeli podamy tylko processId, to dokument zostanie dodany do archiwum i podłączony do wskazanego procesu.
    • Jeżeli nie podamy żadnego z tych parametrów lub podamy tylko activityId, to dokument zostanie dodany tylko do archiwum.

 

Odpowiedź:

  • Odpowiedź zawiera definicję zapisanego pliku

 

Code Block
languagejavascript
titlePrzykład formularza dodawania dokumentu
linenumberstrue
collapsetrue
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]'//id indeksu z bazy danych
                },{
                    xtype:'textfield',
                    value:'wartosc',
                    name:'indexes[4]'//id indeksu z bazy danych
                }
            ]
        }
    
    ],
    buttons:[
        {
            text:'Zapisz',
            handler:function(){
                var form=this.up('window').down('form').getForm();
                form.submit({
                    url:'api/documents/upload'
                });
            }
        }
    ]
});
Tip
titleWsparcie dla InternetExplorer

 W przeglądarce InternetExplorer aby wykonać upload pliku serwer musi odpowiedzieć z nagłówkiem Content-Type: text/html. Należy w takim wypadku wywołać żądanie z dodatkowym parametrem:

responseAsHtml - true wymusza ustawienie nagłówka Content-Type na text/html

Pobieranie dokumentu

Ścieżka do servletu: api/documents/download/{fileId}

Metoda: GET

Parametry:

  • fileId - Id pliku, który chcemy pobrać ( parametr przekazany w ścieżce servlet'u) 

Odpowiedź:

  • Strumień danych z plikiem
  • Status HTTP: OK lub UNAUTHORIZED 

Pobieranie dokumentu

 Ścieżka do servletu: api/documents/get/{filename}

 Metoda : GET

 Parametry :

  • filename - nazwa pliku z rozszerzeniem (przekazany w ścieżce servlet'u)
  • fileId - Id pliku
  • processId - (opcjonalny) Id procesu dla którego chcemy pobrać dokumenty
  • activityId - (opcjonalny) Id zadania dla którego chcemy pobrać dokumenty

Uwaga, parametr systemowy 'AuthorizeUserForFile' określa czy jest wymagana autoryzacja użytkownika dla tego servletu.

Odpowiedź : pobrany plik dokumentu.

Pobieranie informacji o podłączonych dokumentach do zadania

Ścieżka do servletu: api/documents/activity

Metoda : GET

Parametry :

  • processId - Id procesu dla którego chcemy pobrać dokumenty
  • activityId - Id zadania dla którego chcemy pobrać dokumenty

Odpowiedź : Informacje o dokumentach tj. a więc poza plikami także dodatkowe informacje o dokumencie np. przez kogo został podłączony do archiwum i przez kogo został podłączony do procesu itp.

Odłączanie dokumentu od procesu

Ścieżka do servletu: api/documents/{fileId}/{processId}

Metoda: DELETE

Parametry:

  • fileId - Id pliku, który chcemy pobrać ( parametr przekazany w ścieżce servlet'u) 
  • processId - Id procesu, z którego odłączamy plik

Odpowiedź:

  • brak odpowiedzi

Usuwanie dokumentu (od wersji 3.1.31)

Metoda usuwa plik z systemu. Jeżeli usuwany plik jest w wersji np.: 2, a cały dokument ma wersji 5, to usunięte zostaną wszystkie wersje w górę, czyli zostanie tylko plik w wersji 1, chyba że parametr {@code deleteAllVersions=true}, to wtedy zostaną usunięte wszystkie wersje.

Użytkownik musi posiadać uprawnienia do usunięcia tego pliku.

 

Ścieżka do servletu: api/documents/{fileId}

Metoda: DELETE

Parametry:

  • fileId - Id pliku, który chcemy usunąć (parametr przekazany w ścieżce servlet'u) 
  • deleteAllVersions (opcjonalny - domyślnie false) - Określa, czy mają być również usunięte wszystkie wcześniejsze wersje tego dokumentu.

Odpowiedź:

  • brak odpowiedzi

Zmiana wartości indeksów dokumentu (od wersji 3.1.31)

Metoda zmienia przekazane wartości indeksów w podanym dokumencie. Użytkownik musi mieć uprawnienia do modyfikacji dokumentu.

Ścieżka do servletu: api/documents/{fileId}/indexes

Metoda: PUT

Request Content-Typeapplication/json

Parametry:

  • fileId - Id pliku, którego indeksy chcemy zmienić( parametr przekazany w ścieżce servlet'u)

  • indexes - obiekt JSON zawierający indeksy do zmiany:
Code Block
languagejs
titlePrzykład przesyłania indeksów
{
	"2":"Nowa wartość indeksu o id 2",
	"7":"Nowa wartość indeksu o id 7",
	"11":234.62 /* Nowa wartość indeksu zmiennoprzecinkowego o id 11 */
} 

Odpowiedź:

  • brak odpowiedzi

Wyszukiwanie dokumentów na podstawie filtrów (od wersji 3.1.31)

Metoda wyszukuje dokumenty na podstawie podanych filtrów. Brane są pod uwagę uprawnienia użytkownika. Wyszukiwać można w klasie dokumentów (musi być podane id klasy dokumentów w parametrze documentClassId) albo w zestawie dokumentów (musi być podane id zestawu dokumentów w parametrze documentSetId). Nie można wyszukiwać jednocześnie po klasie dokumentów i zestawie dokumentów (tylko jeden parametr może być uzupełniony). Obecnie dodatkowym filtrem są jeszcze indeksy klasy dokumentów/zestawu dokumentów. Jeżeli nie podamy indeksów, to zostaną wyszukane wszystkie dokumenty z podanej klasy dokumentów/zestawu dokumentów.

Maksymalna liczba dokumentów zwrócona w jednym wywołaniu: 100 000

Ścieżka do servletu: api/documents/query

Metoda: POST

Request Content-Typeapplication/json

Parametry:

  • obiekt JSON zawierający filtry

    Code Block
    languagejs
    titlePrzykład przesyłania indeksów
    {
    	"documentClassId": 1, //id klasy dokumentów
    	//lub
    	"documentSetId": 3, //id zestawu dokumentów
    	
    	"indexes": { //indeksy dokumentu
    		"2":"Wartość indeksu o id 2",
    		"7":"Wartość indeksu o id 7",
    		"11":234.62 /* Wartość indeksu zmiennoprzecinkowego o id 11 */
    	},
        	"start": 0, // pozycja od której zwracane są dokumenty (domyślnie: 0)
        	"limit": 100 // maksymalna ilość zwracanych dokumentów (domyślnie: 100 000)
    } 

Odpowiedź:

  • Lista wyszukanych dokumentów
Code Block
languagejavascript
titlePrzykładowa odpowiedź
linenumberstrue
collapsetrue
[
   {
      "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"
         }
      ]
   }
]

Wyszukiwanie ilości dokumentów na podstawie filtrów (od wersji 4.1.2)

Metoda wyszukuje ilość dokumentów na podstawie podanych filtrów. Brane są pod uwagę uprawnienia użytkownika. Wyszukiwać ilość można w klasie dokumentów (musi być podane id klasy dokumentów w parametrze documentClassId) albo w zestawie dokumentów (musi być podane id zestawu dokumentów w parametrze documentSetId). Nie można wyszukiwać jednocześnie po klasie dokumentów i zestawie dokumentów (tylko jeden parametr może być uzupełniony). Obecnie dodatkowym filtrem są jeszcze indeksy klasy dokumentów/zestawu dokumentów. Jeżeli nie podamy indeksów, to zostanie wyszukana ilość wszystkich dokumentów z podanej klasy dokumentów/zestawu dokumentów.

Ścieżka do servletu: api/documents/query/count

Metoda: POST

Request Content-Typeapplication/json

Parametry:

  •  obiekt JSON zawierający filtry

    Code Block
    languagejs
    titlePrzykład przesyłania indeksów
    {
    	"documentClassId": 1, //id klasy dokumentów
    	//lub
    	"documentSetId": 3, //id zestawu dokumentów
    	
    	"indexes": { //indeksy dokumentu
    		"2":"Wartość indeksu o id 2",
    		"7":"Wartość indeksu o id 7",
    		"11":234.62 /* Wartość indeksu zmiennoprzecinkowego o id 11 */
    	}
    } 

Odpowiedź:

  • liczba będąca ilością dokumentów
Code Block
languagejavascript
titlePrzykładowa odpowiedź
linenumberstrue
collapsetrue
1000

Pobieranie wszystkich wersji pliku

Ścieżka do servletu: api/documents/{fileId}/versions

Metoda: GET

Parametry:

  • fileId- Id pliku dla którego chcemy pobrać  wszystkie wersje( parametr przekazany w ścieżce servlet'u) 

Odpowiedź:

  • Odpowiedź zawiera listę dokumentów.
Code Block
languagejavascript
titlePrzykładowa odpowiedź
linenumberstrue
collapsetrue
[
   {
        "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
    }
]
 

Zmiana danych w bazie odnośnie pobranego dokumentu

Zmienia dane w bazie danych odnośnie pobrania dokumentu do zmiany. Ustawia odpowiedni status, datę pobrania dokumentu, oraz użytkownika pobierającego.

Ścieżka do servletu: api/documents/{fileId}/checkOut

Metoda: PUT

Parametry:

  • fileId- Id pliku ( parametr przekazany w ścieżce servlet'u)

Odpowiedź:

  • Odpowiedni HTTPStatus: OK, CONFLICT lub FORBIDDEN 

Anulowanie wprowadzania zmian do pobranego dokumentu

Anuluje wprowadzanie zmian do dokumentu. Ustawia odpowiedni status, resetuje datę pobrania dokumentu, oraz użytkownika pobierającego.

Ścieżka do servletu: api/documents/{fileId}/undoCheckOut

Metoda: PUT

Parametry:

  • fileId- Id pliku ( parametr przekazany w ścieżce servlet'u)

Odpowiedź:

  • Odpowiedni HTTPStatus: OK lub CONFLICT

Zapisuje nową wersję pliku

Zapisuje nową wersję pliku, który wcześniej pobraliśmy do zmiany.

Ścieżka do servletu: api/documents/checkIn

Metoda: POST

enctypemultipart/form-data

Treść zapytania:

Formularz HTML zawierający definicję dokumentu. Definicja powinna zawierać następujące pole:

    • file - Pole typu file 
    • description - Opis
    • parentFileId - id pliku, który aktualizujemy
    • comment - komentarz
    Code Block
    titlePrzykładowa treść zapytania z programu POSTMAN
    collapsetrue
    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--

Odpowiedź:

  • Odpowiedź zawiera id zapisanego pliku w przypadku poprawnego zapisu lub treść błędu w zależności od zwróconego statusu odpowiedzi.

Pobieranie aktualnego statusu dokumentu

Ścieżka do servletu: api/documents/{fileId}/status

Metoda: GET

Parametry:

  • fileId - Id pliku

Odpowiedź:

  • Aktualny status dokumentu.
Code Block
languagejavascript
titlePrzykładowa odpowiedź
linenumberstrue
collapsetrue
"STATE_READY"
English

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.
Code Block
titleExample answer
linenumberstrue
collapsetrue
[
   {
      "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.

 

Code Block
titleExample answer
linenumberstrue
collapsetrue
[
   {
      "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

      Code Block
      languagejs
      titleAn 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:

      Code Block
      languagejs
      titleAn 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*/
      }
    Code Block
    titleExample of the content of a query from POSTMAN
    collapsetrue
    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

 

Code Block
titleExample of a form for adding a document
linenumberstrue
collapsetrue
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'
                });
            }
        }
    ]
});
Tip
title 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:
Code Block
languagejs
titleExample 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

    Code Block
    languagejs
    titleExample 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 */
    	}
    } 

Answer:

  • List of searched documents
Code Block
titleExample answer
linenumberstrue
collapsetrue
[
   {
      "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
Code Block
titleExample answer
linenumberstrue
collapsetrue
[
   {
        "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
    Code Block
    titleExample of the content of a query from POSTMAN
    collapsetrue
    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.
Code Block
titleExample answer
linenumberstrue
collapsetrue
"STATE_READY"