Document
Overview
A Document resources represents the template configuration for
Fields
| Field | Type | Description |
|---|---|---|
| id | String | The ID of the document. |
| documentType | String | The type of document for this template. This will either be the value "GOOGLE_DOCS" or "GOOGLE_SLIDES" depending on the file that is selected. |
| file | Google File | The Google File that is a template document within the workflow. This file will be copied to create the output document. |
| outputName | String | A templated string used to generate the name for the output created from this template. |
| createPDFCopy | Boolean | A flag to enable creating a PDF copy of the output document. |
| removeOutput | Bolean | A flag to enable removing the original output document (Google Docs/Slides) files after a PDF copy has been made. |
| enablePdfPassword | Boolean | A flag to enable pdf encryption of the created PDF. |
| pdfPassword | String | A templated string used to generate the password for the PDF. Only used if the `enablePdfPassword` flag is enabled. |
| PdfPasswordPreventCopy | Boolean | A flag to prevent content of the PDF being copied when the PDF is protected with a password. |
| previewUrl | String | A url to the embedded editor used for non-Portant users changes to this document using source fields. It is assumed these users can access the associated Google File. NOTE: This feature has not yet been implemented and my be subject to change. |
Example
{
"id": "doc_5LGGqC5S78RNS0",
"documentType": "GOOGLE_DOCS",
"file": {
"id": "1uNfBHAKhcgRsiftb7xRpTJRS0k9LY1iX1gUnTOE0zU4",
"name": "Complete Workflow Please - [Template]",
"url": "https://docs.google.com/document/d/1uNfBHAKhcgRsiftb7xRpTJRS0k9LY1iX1gUnTOE0zU4/edit?usp=drivesdk",
"mimeType": "application/vnd.google-apps.document"
},
"outputName": "Document for {{First Name}}",
"createPdfCopy": true,
"removeOutput": false,
"enablePdfPassword": false,
"pdfPassword": "Password-{{Secret Number}}",
"pdfPasswordPreventCopy": false,
"previewUrl": "https://preview.portant.co/doc_5LGGqC5S78RNS0"
}
Endpoints
List all Documents for a Workflow
GET /workflows/<wkf_id>/documents/
List all documents of the specific workflow as specified by the id.
Responses
| Status | Body |
|---|---|
| 200 OK | Array<Document> |
| 403 Unauthorised | Error |
Create a Document for a Workflow
POST /workflows/<wkf_id>/documents/
Create a new document for the specified workflow.
Request
A create Document object as JSON.
The payload may contain an optional file_id field with a file ID for a file in Google Drive that the requesting user has access to.
{
file_id?: "1uNfBHAKhcgRsiftb7xRpTJRS0k9LY1iX1gUnTOE0zU4"
}
Alternatively, the file_id can be omitted in order to create a new document.
Responses
| Status | Body |
|---|---|
| 201 Created | Document |
| 400 Bad Request | Error |
| 403 Unauthorised | Error |
Get a Document
GET /workflows/<wkf_id>/documents/<doc_id>/
Retrieve a specific document of a specific workflow.
Responses
| Status | Body |
|---|---|
| 200 OK | Document |
| 403 Unauthorised | Error |
Update a Document
PATCH /workflows/<wkf_id>/documents/<doc_id>/
Update a specific document as specified by its id.
Request
A partial Document object as JSON.
The payload may contain an of the editable fields of the document. Note, the selected file for a document can not be changed once it is created.
{
"outputName"?: "New outputName for {{First Name}}",
"pdfPassword"?: "NewPassword-{{Secret Number}}",
"enablePdfPassword"?: true,
"enablePdfPreventCopy"?: true,
}
Responses
| Status | Body |
|---|---|
| 200 OK | Document |
| 400 Bad Request | Error |
| 403 Unauthorised | Error |