Portant Docs

Document

Un Document rappresenta la configurazione di un template in un workflow. Punta a un file di Google Drive che viene copiato per produrre ogni output.

Fields

FieldTypeDescription
idStringL'ID del documento.
documentTypeStringIl tipo di template. Può essere "GOOGLE_DOCS" o "GOOGLE_SLIDES", a seconda del file selezionato.
fileGoogle FileIl file di Google Drive utilizzato come template. Questo file viene copiato per creare il documento di output.
outputNameStringUna stringa con template utilizzata per assegnare un nome a ogni output creato da questo template.
createPDFCopyBooleanSe true, Portant crea anche una copia PDF del documento di output.
removeOutputBooleanSe true, il documento di output originale (Google Docs o Slides) viene rimosso dopo la creazione della copia PDF.
enablePdfPasswordBooleanSe true, il PDF generato viene crittografato con una password.
pdfPasswordStringUna stringa con template utilizzata per generare la password del PDF. Viene utilizzata solo quando enablePdfPassword è true.
PdfPasswordPreventCopyBooleanSe true, non è possibile copiare il contenuto dal PDF protetto da password.
previewUrlStringUn URL all'editor incorporato utilizzato dagli utenti non Portant per apportare modifiche a questo documento tramite i campi sorgente. Presuppone che l'utente possa già accedere al file Google sottostante.

Nota: questa funzionalità non è ancora implementata e potrebbe essere soggetta a modifiche.

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/

Elenca tutti i documenti per un workflow specifico.

Responses

Status Body
200 OK Array<Document>
403 Unauthorised Error

Create a document for a workflow

POST /workflows/<wkf_id>/documents/

Crea un nuovo documento per il workflow.

Request

Un oggetto Document di tipo create in formato JSON.

Il payload può includere un file_id facoltativo per un file di Google Drive a cui l'utente richiedente ha accesso.

{
    file_id?: "1uNfBHAKhcgRsiftb7xRpTJRS0k9LY1iX1gUnTOE0zU4"
}

Se si omette file_id, viene creato un nuovo documento da zero.

Responses

Status Body
201 Created Document
400 Bad Request Error
403 Unauthorised Error

Get a document

GET /workflows/<wkf_id>/documents/<doc_id>/

Recupera un documento specifico in un workflow specifico.

Responses

Status Body
200 OK Document
403 Unauthorised Error

Update a document

PATCH /workflows/<wkf_id>/documents/<doc_id>/

Aggiorna un documento specifico tramite ID.

Request

Un oggetto Document parziale in formato JSON. Il payload può includere qualsiasi campo modificabile del documento. Il file selezionato non può essere modificato dopo la creazione di un documento.

{
    "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