Intelligent Document Processing
processmaker.comKnowledge CenterDevelopers Corner
  • ProcessMaker Intelligent Document Processing
  • What's New
  • Release Notes
  • Glossary
  • 🟦IDP User
    • Document Management
      • Files and Folders
      • Preview a Document
      • Version Control
      • Access Control
      • Elastic Search
    • Intelligent Document Processing
  • 🟪IDP Administrator
    • Entity Management
      • Create a New Entity
    • Excel Import and Export
    • OCR Service
    • Classification Service
    • Named Entity Recognition
    • Annotations
    • Authorization
      • Example Authorization Configuration
    • Importer
    • Elastic Search Configuration
    • Email Integration
    • Email Notifications
    • Audit Log
    • Retention Management
    • Power BI
    • Exports
    • Translations
  • 🟦ProcessMaker Administrator and Designer
    • IDP Admin Settings
    • IDP Connector in Processes
  • 🟩IDP Developer
    • REST API Home
    • Key Concepts
    • Authentication
    • Request Syntax
    • Endpoints for Entity Objects
    • Endpoints for Documents
    • WebSockets
Powered by GitBook
On this page
  • Base URL for Document Endpoints
  • View Metadata of a Document
  • Update Documents
  1. IDP Developer

Endpoints for Documents

Interact with IDP documents through APIs from ProcessMaker scripts.

Base URL for Document Endpoints

Access the server via https://{processmaker-server}/api/1.0/connector-idp.

View Metadata of a Document

GET https://{processmaker-server}/api/1.0/connector-idp/get-file/{id}

See 200 status code response for cURL example and response example.

Path Parameters

Name
Type
Description

id*

String

Unique ID for the document to find in the information document section of the IDP server.

Following is an example of getting a document metadata using the file id.

cURL request:

curl --location --request GET "https://processmaker.com/api/1.0/connector-idp/get-file/d72c9a40-8ef1-4c16-94c8-038cd9b80089"

Example response:

The request was okay and the response body contains the representation requested.

{
  "data": {
    "type": "file",
    "attributes": {
      "createdAt": "2019-11-29T09:46:29.006+0000",
      "createdBy": "User",
      "documentType": "NONE",
      "modifiedAt": "2019-12-03T07:41:33.445+0000",
      "name": "Welcome to IDP.docx",
      "modifiedBy": null,
      "checkedOutBy": null,
      "id": "d72c9a40-8ef1-4c16-94c8-038cd9b80089",
      "content": 117350
    },
    "relations": {}
  },
  "status": "success",
  "message": null
}
<?php 
/*  
 *  Welcome to ProcessMaker 4 Script Editor 
 *  To access Environment Variables use getenv("ENV_VAR_NAME") 
 *  To access Request Data use $data 
 *  To access Configuration Data use $config 
 *  To preview your script, click the Run button using the provided input and config data 
 *  Return an array and it will be merged with the processes data 
 *  Example API to retrieve user email by their ID $api->users()->getUserById(1)['email'] 
 *  API Documentation https://github.com/ProcessMaker/docker-executor-php/tree/master/docs/sdk 
 */

$start = microtime(true);
$guzzleClient = new \$GuzzleHttp\Client(['base_uri'=> getenv('API_HOST'),'verify' => false]);
$guzzleOptions['headers']['Accept'] = 'application/json';
$guzzleOptions['headers']['Authorization'] = 'Bearer'.getenv('API_TOKEN');

$guzzleApi = '/api/1.0/connector-idp/get-file/be74e981-f82c-data-b906-669724f0c37f';
$result = json_decode($guzzleClient->request('GET', $guzzleApi, $guzzleOptions)->getBody(),true)['data'];

return $result;

Update Documents

PUT https://{processmaker-server}/api/1.0/connector-idp/update-file/{id}

See 200 status code response for cURL example and response example.

Path Parameters

Name
Type
Description

id*

String

Unique ID for the document to find in the information document section of the IDP server.

Request Body

Name
Type
Description

data

JSON String

Attributes specified as key-value pairs. Check the example response to see the JSON structure to send

Here is an example of updating a file using the file id., where the file attributes are being updated.

cURL request:

curl --location --request PUT "https://processmaker.com/api/1.0/connector-idp/update-file/d72c9a40-8ef1-4c16-94c8-038cd9b80089"

Example response:

The request was okay and the response body contains the representation requested. The response contains all attributes of the updated document.

{
  "data": {
    "type": "file",
    "attributes": {
      "createdAt": "2023-12-03T12:47:06.960+0000",
      "createdBy": "User",
      "documentType": "NONE",
      "modifiedAt": "2023-12-05T12:47:06.960+0000",
      "name": "Welcome back to IDP.docx",
      "modifiedBy": "User2",
      "checkedOutBy": "User",
      "id": "d72c9a40-8ef1-4c16-94c8-038cd9b80089",
      "content": 125398,
      "parentId": null
    }
  },
  "status": "success",
  "message": null
}
<?php 
/*  
 *  Welcome to ProcessMaker 4 Script Editor 
 *  To access Environment Variables use getenv("ENV_VAR_NAME") 
 *  To access Request Data use $data 
 *  To access Configuration Data use $config 
 *  To preview your script, click the Run button using the provided input and config data 
 *  Return an array and it will be merged with the processes data 
 *  Example API to retrieve user email by their ID $api->users()->getUserById(1)['email'] 
 *  API Documentation https://github.com/ProcessMaker/docker-executor-php/tree/master/docs/sdk 
 */

$start = microtime(true);
$guzzleClient = new \$GuzzleHttp\Client(['base_uri'=> getenv('API_HOST'),'verify' => false]);
$guzzleOptions['headers']['Accept'] = 'application/json';
$guzzleOptions['headers']['Authorization'] = 'Bearer'.getenv('API_TOKEN');

$guzzleOptions['json'] = [
    "attributes" => [
        "fulltext" => "Hello World",
        "name" => "Finance Invoice",
        "documentType" => "Invoice"
    ]
];

$guzzleApi = '/api/1.0/connector-idp/get-file/be74e981-f82c-data-b906-669724f0c37f';
$result = json_decode($guzzleClient->request('GET', $guzzleApi, $guzzleOptions)->getBody(),true)['data'];

return $result;
PreviousEndpoints for Entity ObjectsNextWebSockets

Last updated 9 months ago

to get the metadata of the IDP file using a file id.

and reference the created script.

to update the metadata (fulltext, name, documentType) of the IDP file using a file id.

and reference the created script.

🟩
Create a Script
Add a Script Task to your process model
Create a Script
Add a Script Task to your process model