Create PDF based document with attachment

Circularo REST API example

Create two PDF files in Circularo and use them to create file-based document with attachment.

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 “J2cxBAuzIpYXfmgZsgKGVfv4TFCQbkUvkoWJjxcHPKCtZm3Eov8wtiNMEFCLqdFA“.

Step 2 - Create new PDF file

Create new PDF file in the Circularo.

Endpoint

POST - /files/saveFile

Example

/files/saveFile?token=J2cxBAuzIpYXfmgZsgKGVfv4TFCQbkUvkoWJjxcHPKCtZm3Eov8wtiNMEFCLqdFA

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 “HLQg31Bh0DJ4Khn2vH8xPIHMqiblaV6GwhTfuvr9l4r0zhDgABO4AgP79NYIXC2R“.

The file is now created.

Step 3 - Create another PDF file

Create another PDF file in the Circularo.

Endpoint

POST - /files/saveFile

Example

/files/saveFile?token=J2cxBAuzIpYXfmgZsgKGVfv4TFCQbkUvkoWJjxcHPKCtZm3Eov8wtiNMEFCLqdFA

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 “qpOGd8be1huAtyS8S0S4cV5LIq5JXm5rfz5XSsJNl8QtNooe34thNNkkm7ZMcRzl“.

The file is now created.

Step 4 - Create PDF based document with attachment

Create new document from existing PDF file with another PDF file as an attachment.

Endpoint

POST - /documents

Example

/documents?token=J2cxBAuzIpYXfmgZsgKGVfv4TFCQbkUvkoWJjxcHPKCtZm3Eov8wtiNMEFCLqdFA

Content-Type: application/json

{
  "body": {
    "documentType": "d_default",
    "documentTitle": "My file based document",
    "pdfFile": {
      "content": "HLQg31Bh0DJ4Khn2vH8xPIHMqiblaV6GwhTfuvr9l4r0zhDgABO4AgP79NYIXC2R"
    },
    "file": [
      {
        "content": "qpOGd8be1huAtyS8S0S4cV5LIq5JXm5rfz5XSsJNl8QtNooe34thNNkkm7ZMcRzl"
      }
    ]
  },
  "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 “93f46b3c-d424-4c5b-b668-25b05c4794ef“.

The PDF based document with attachment is now created.

Step 5 - Sign out (Optional)

Sign user out.

Endpoint

GET - /logout

Example

/logout?token=J2cxBAuzIpYXfmgZsgKGVfv4TFCQbkUvkoWJjxcHPKCtZm3Eov8wtiNMEFCLqdFA