Portant Docs

Workflows

Un Workflow rappresenta le fasi di un'automazione che, nella sua forma più semplice, trasforma dati di origine in documenti di output.

Fields (Campi)

FieldTypeEditableDescription
idStringfalseL'ID univoco del workflow. Utilizzato per fare riferimento al workflow in tutte le richieste.
nameStringtrueIl nome del workflow.
colorStringtrueIl colore dell'icona del workflow in Portant Workflow come stringa esadecimale, con prefisso #.
iconStringtrueIl nome dell'icona utilizzata in Portant Workflow.
statusStringfalseLo stato attuale del workflow. Uno tra:
- "COMPLETE": il workflow è eseguibile.
- "INCOMPLETE": il workflow richiede ulteriore configurazione prima di poter essere eseguito.
- "ARCHIVED": il workflow non è più utilizzabile.
autoCreateBooleanfalseSe true, il workflow rimane in ascolto di eventi di origine e crea una nuova automazione ogni volta che ne arriva uno.
ownerOwnerfalseIl proprietario di questo workflow.
teamTeamfalseIl team a cui appartiene questo workflow.
sourceSourcefalseLa fonte di dati per questo workflow.
documentsDocumentfalseI documenti modello per questo workflow.
outgoingWebhook

Outgoing

Webhook

falseIl Webhook in uscita di questo workflow, utilizzato per ascoltare gli eventi di automazione.
createdByApiBooleanfalseTrue quando il workflow è stato creato tramite l'API per sviluppatori.
createdAtStringfalseUn timestamp ISO 8601 indicante quando il workflow è stato creato.
updatedAtStringfalseUn timestamp ISO 8601 indicante quando il workflow è stato aggiornato per l'ultima volta.

Example (Esempio)

```json
{
    "id": "wkf_kGQK9PBWDT1JCr",
    "name": "Invoice Workflow",
    "icon": "DocumentText",
    "color": "#cccccc",
    "status": "COMPLETE",
    "autoCreate": true,
    "owner": {
        "id": "usr_DsH4TGYXs4XPpB",
        "name": "Blake Lockley",
        "email": "blake@portant.co"
    },
    "team": null,
    "source": {
        "id": "src_NZHJYjlgrvklHb",
        "sourceType": "WEBHOOK",
        "sourceFields": [
            "Order Number",
            "LineItem.Name",
            "LineItem.Price",
        ],
        "webhookUrl": "https://webhooks.portant.co/50c7912b14c7acbe9df32521ec60a27c"
    },
    "documents": [
        {
            "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}}",
            "pdfPassword": "jeRe/\/\eyWaZH3re",
            "enablePdfPassword": true,
            "enablePdfPreventCopy": false,
            "previewUrl": "https://preview.portant.co/doc_5LGGqC5S78RNS0"
        }
    ],
    "outgoingWebhook": {
        "id": "owc_XY1Ys4gqrpX8cp",
        "webhookUrl": "https://webhook.site/d22c56ab-40ac-4f9a-93ef-02520235c0da"
    },
    "createdByApi": true,
    "createdAt": "2024-08-12T16:20:44.346666+10:00",
    "updatedAt": "2024-08-12T16:20:48.408357+10:00"
}
```

Endpoints

List all workflows (Elenca tutti i workflow)

GET /workflows/

Restituisce ogni Workflow di proprietà dell'utente API o condiviso con il suo team.

Responses (Risposte)

Status Body
200 OK Array<Workflow>
403 Unauthorised Error

Create a workflow (Crea un workflow)

POST /workflows/

Crea un nuovo workflow.

Request (Richiesta)

Un oggetto Workflow parziale in formato JSON. L'unico campo obbligatorio è name.

{
    name: "A simple workflow"
}

È inoltre possibile creare un workflow completo in un singolo POST includendo i sottocomponenti facoltativi e i relativi campi obbligatori.

I campi con suffisso ? sono facoltativi.

{
    name: "A complete Workflow from Scratch",
    color?: "#...",
    icon?: "...",
    source?: {
        "sourceFields": ["Field Name 1", "Field Name 2"]
    },
    document?: {
        fileId: "<google file id>"
    },
    outgoingWebhook?: {
        webhookUrl: "<webhook url for event listening>"
    }
}

Risposte

Stato Corpo
201 Created Workflow
400 Bad Request Error
403 Unauthorised Error

Recuperare un workflow

GET /workflows/<wkf_id>/

Recupera un workflow specifico tramite ID.

Risposte

Stato Corpo
200 OK Workflow
403 Unauthorised Error
404 Not Found Error

Aggiornare un workflow

PATCH /workflows/<wkf_id>/

Aggiorna un workflow specifico tramite ID.

Richiesta

Un oggetto Workflow parziale in formato JSON. I campi con suffisso ? sono facoltativi.

{
    name?: "...",
    color?: "#...",
    icon?: "..."
 }

Risposta

Stato Corpo
200 OK Workflow
400 Bad Request Error
403 Unauthorised Error
404 Not Found Error

Eliminare un workflow

DELETE /workflows/<wkf_id>/

Elimina un workflow specifico tramite ID. Il workflow non viene effettivamente eliminato: il suo stato viene impostato su "ARCHIVED". I workflow archiviati possono essere ripristinati contattando il team di assistenza clienti.

Risposta

Stato Corpo
204 No Content
400 Bad Request Error
403 Unauthorised Error
404 Not Found Error