Create multi-document

Circularo REST API example

Creates PDF-based document by merging multiple files into one PDF.

Step 1 - Sign in

Sign user in.

Endpoint

POST - /login

Example

/login

Content-Type: application/json

{
  "name": "mary.griffin@circularo.com",
  "password": "#32Password1!",
  "tenant": "default"
}

Response

Note following properties in response object:

  • token - In response object at position ‘token‘. It may have value of “MP61l6mW0LQAGsCsOXc5cHw6dAvZuCqQgO7dFHU60Vc4Dd8ZNKc44q9V6kS8qQQ7“.

Step 2 - Create new RTF file

Create new RTF file in the Circularo.

Endpoint

POST - /files/saveFile

Example

/files/saveFile?token=MP61l6mW0LQAGsCsOXc5cHw6dAvZuCqQgO7dFHU60Vc4Dd8ZNKc44q9V6kS8qQQ7

Content-Type: multipart/form-data

{
  "file": "blob",
  "fileName": "My RTF file"
}

Response

Note following properties in response object:

  • fileId - In response object at position ‘file.id‘. It may have value of “NI3wENIl7JY72Ge4mZe8wm3okoeJk078leYgVYIflw15MZ501B3ZP29yNbiW32UN“.

The file is now created.

Step 3 - Create new PDF file

Create new PDF file in the Circularo.

Endpoint

POST - /files/saveFile

Example

/files/saveFile?token=MP61l6mW0LQAGsCsOXc5cHw6dAvZuCqQgO7dFHU60Vc4Dd8ZNKc44q9V6kS8qQQ7

Content-Type: multipart/form-data

{
  "file": "blob",
  "fileName": "My PDF file"
}

Response

Note following properties in response object:

  • fileId - In response object at position ‘file.id‘. It may have value of “gRg8JgFXAKun1BglG8lhkKXV9KTdh90xQ3nckfXhP8RNehZsJPtS9SztGa9ZAfcS“.

The file is now created.

Step 4 - Create another PDF file

Create another PDF file in the Circularo.

Endpoint

POST - /files/saveFile

Example

/files/saveFile?token=MP61l6mW0LQAGsCsOXc5cHw6dAvZuCqQgO7dFHU60Vc4Dd8ZNKc44q9V6kS8qQQ7

Content-Type: multipart/form-data

{
  "file": "blob",
  "fileName": "Another PDF file"
}

Response

Note following properties in response object:

  • fileId - In response object at position ‘file.id‘. It may have value of “GFhIHJRxVPuBGKpHnsv4MNjwIbzxDpj23hErnCtVwK44H42z1AR5epQdzsW2W6Ke“.

The file is now created.

Step 5 - Create multi-document

Create new PDF document consisted of multiple files. Document main PDF file will be created from files specified in “optionalData” object, order matters.

Endpoint

POST - /documents

Example

/documents?token=MP61l6mW0LQAGsCsOXc5cHw6dAvZuCqQgO7dFHU60Vc4Dd8ZNKc44q9V6kS8qQQ7

Content-Type: application/json

{
  "body": {
    "documentType": "d_default",
    "documentTitle": "My multi-document file",
    "pdfFile": {
      "content": "NI3wENIl7JY72Ge4mZe8wm3okoeJk078leYgVYIflw15MZ501B3ZP29yNbiW32UN"
    },
    "file": [
      {
        "content": "gRg8JgFXAKun1BglG8lhkKXV9KTdh90xQ3nckfXhP8RNehZsJPtS9SztGa9ZAfcS"
      },
      {
        "content": "GFhIHJRxVPuBGKpHnsv4MNjwIbzxDpj23hErnCtVwK44H42z1AR5epQdzsW2W6Ke"
      }
    ]
  },
  "optionalData": {
    "convert": true,
    "merge": [
      "NI3wENIl7JY72Ge4mZe8wm3okoeJk078leYgVYIflw15MZ501B3ZP29yNbiW32UN",
      "gRg8JgFXAKun1BglG8lhkKXV9KTdh90xQ3nckfXhP8RNehZsJPtS9SztGa9ZAfcS",
      "GFhIHJRxVPuBGKpHnsv4MNjwIbzxDpj23hErnCtVwK44H42z1AR5epQdzsW2W6Ke"
    ]
  },
  "definitionType": "ext",
  "workflow": "wf_archive"
}

Response

Note following properties in response object:

  • documentId - In response object at position ‘results[0].documentId‘. It may have value of “d2b96629-384a-4bd9-bf66-f8017e500bc8“.

Document is now created and can be used as any other document. Document main file has been created by joining all specified files into one PDF file.

Step 6 - Sign out (Optional)

Sign user out.

Endpoint

GET - /logout

Example

/logout?token=MP61l6mW0LQAGsCsOXc5cHw6dAvZuCqQgO7dFHU60Vc4Dd8ZNKc44q9V6kS8qQQ7