Create new RTF document

Circularo REST API example

Create RTF based document from file. Then download both original RTF file and exported PDF 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 “2q9y7DnnhJQszYOIQX6Ri1RkFyxLTCaOM2NwuOR8jW6NfwECZEvH7n4ymdq4pSTO“.

Step 2 - Create new RTF file

Create new RTF file in the Circularo.

Endpoint

POST - /files/saveFile

Example

/files/saveFile?token=2q9y7DnnhJQszYOIQX6Ri1RkFyxLTCaOM2NwuOR8jW6NfwECZEvH7n4ymdq4pSTO

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

The file is now created.

Step 3 - Create RTF based document

Create new document from existing RTF file. As conversion is NOT switched on, the document WON’T BE converted to PDF type.

In ‘“definitionType”: “ext”‘ you are always specifying “pdfFile” object, no matter what content type the file is.

Endpoint

POST - /documents

Example

/documents?token=2q9y7DnnhJQszYOIQX6Ri1RkFyxLTCaOM2NwuOR8jW6NfwECZEvH7n4ymdq4pSTO

Content-Type: application/json

{
  "body": {
    "documentType": "d_default",
    "documentTitle": "My file based document",
    "pdfFile": {
      "content": "XMKPUzUNi4zUvlSA7Dy6XAzmJwuqGj4tpy3YIXt0UgaKgYqqbMQ7fq0Ss5LdHvwf",
      "_content_type": "application/rtf"
    }
  },
  "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 “9738c919-c8bc-4ba4-ad2d-eb9445da7c79“.

The RTF based document is now created.

Step 4 - Download file

Download file based on its hash (fileId).

Endpoint

GET - /files/loadFile/hash/:hash

Example

/files/loadFile/hash/XMKPUzUNi4zUvlSA7Dy6XAzmJwuqGj4tpy3YIXt0UgaKgYqqbMQ7fq0Ss5LdHvwf?token=2q9y7DnnhJQszYOIQX6Ri1RkFyxLTCaOM2NwuOR8jW6NfwECZEvH7n4ymdq4pSTO

This endpoint now returns the file.

Step 5 - Export to PDF

Export document to PDF.

Endpoint

POST - /export

Example

/export?token=2q9y7DnnhJQszYOIQX6Ri1RkFyxLTCaOM2NwuOR8jW6NfwECZEvH7n4ymdq4pSTO

Content-Type: application/json

{
  "exporterName": "pdf",
  "query": {
    "fields": [
      {
        "field": "_id",
        "value": "9738c919-c8bc-4ba4-ad2d-eb9445da7c79",
        "type": "term"
      }
    ]
  }
}

This endpoint now returns converted PDF file.

Step 6 - Sign out (Optional)

Sign user out.

Endpoint

GET - /logout

Example

/logout?token=2q9y7DnnhJQszYOIQX6Ri1RkFyxLTCaOM2NwuOR8jW6NfwECZEvH7n4ymdq4pSTO