Share document to view and download it

Circularo REST API example

First user creates new file in Circularo and use it to create the document. Document is then shared to external recipient to view it. The external recipient then gets document information and downloads the file.

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

Step 2 - Create new PDF file

Create new PDF file in the Circularo.

Endpoint

POST - /files/saveFile

Example

/files/saveFile?token=D1Lzuhi2AFFK61zE4iy7USRePdxsrjT6r1zRwB6fFzSVt1wyjfPtXBi2OlCp8u6Q

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

The file is now created.

Step 3 - Create PDF based document

Create new document from existing PDF file.

Endpoint

POST - /documents

Example

/documents?token=D1Lzuhi2AFFK61zE4iy7USRePdxsrjT6r1zRwB6fFzSVt1wyjfPtXBi2OlCp8u6Q

Content-Type: application/json

{
  "body": {
    "documentType": "d_default",
    "documentTitle": "My file based document",
    "pdfFile": {
      "content": "Kl44bxSrbQlqHxOv2ptkrKbZOhUb2VgwyPNwY6uZEMbQcGTmbptckMig7pOmbVtx",
      "_content_type": "application/pdf"
    }
  },
  "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 “ef78b87b-4436-4760-984b-a79e0d2521cc“.

The PDF based document is now created.

Step 4 - Share document to be viewed

Share selected document to external recipient for view.

You can specify multiple users in “data” array.

Endpoint

POST - /share

Example

/share?token=D1Lzuhi2AFFK61zE4iy7USRePdxsrjT6r1zRwB6fFzSVt1wyjfPtXBi2OlCp8u6Q

Content-Type: application/json

{
  "id": "ef78b87b-4436-4760-984b-a79e0d2521cc",
  "type": "d_default",
  "objectType": "document",
  "data": [
    {
      "sharePurpose": "view",
      "shareTo": "external.bill@circularo.com",
      "password": "SharePassword"
    }
  ]
}

Response

Note following properties in response object:

  • shareId - In response object at position ‘[0].shareId‘. It may have value of “z4CLQSBypOtp95m7DslSAJe3RGGk3smfi8j6qsj7jD25xIttWn4XlQ3Am0R5L94A“.

The document is now shared to be viewed.

Step 5 - Sign out (Optional)

Sign user out.

Endpoint

GET - /logout

Example

/logout?token=D1Lzuhi2AFFK61zE4iy7USRePdxsrjT6r1zRwB6fFzSVt1wyjfPtXBi2OlCp8u6Q

Step 6 - Get shared document information

Retrieve shared document information.

Endpoint

GET - /share/document

Example

/share/document?shareId=z4CLQSBypOtp95m7DslSAJe3RGGk3smfi8j6qsj7jD25xIttWn4XlQ3Am0R5L94A&otp=SharePassword

Response

Note following properties in response object:

  • documentVersion - In response object at position ‘results._version‘. It may have value of 5.

Retrieved object contains information about the document and interested users.

Step 7 - Get shared document main file

Download shared document main file.

Endpoint

GET - /share/document/file

Example

/share/document/file?shareId=z4CLQSBypOtp95m7DslSAJe3RGGk3smfi8j6qsj7jD25xIttWn4XlQ3Am0R5L94A&otp=SharePassword

This endpoint now returns the file.