DynaForm Endpoints

The current methods implemented for the Dynaform resources in the ProcessMaker API designer are listed below:

Dynaform resources:

NameDescription Type Value
dyn_uidDynaform UIDString"9541049475298f190420f51086854718" (string of 32 characters)
dyn_titleDynaform titleString"Title…"
dyn_descriptionDynaform descriptionString"Description…"
dyn_typeDynaform typeString"xmlform", "grid" (unique values)
dyn_contentDynaform contentStringString with the content.
dyn_versionDynaform versionInteger1. Old version. 2. New version
copy_import **Dynaform data to copy/importObjectObject with the following attributes: prj_uid and dyn_uid
copy_import . prj_uid **Process UIDString"7389179125176dac806d205065699622" (string of 32 characters)
copy_import . dyn_uid **Dynaform UID to Copy / ImportString"77941473952b49c65a01a80041727578" (string of 32 characters)
pmtable **PM Table dataObjectObject with the following attributes: tab_uid and fields
pmtable . tab_uid **PMTable UIDString"72249773552b84ded1d8aa4036518645" (string of 32 characters)
pmtable . fields **Define the primary key field to register the PM TableObjectObject array with the following attributes: fld_name and pro_variable
pmtable . fields . fld_name **Primary field of the PM TableString"ID"
pmtable . fields . pro_variable **Variable name whose value will be stored in the primary key fieldString"@#APPLICATION"

Note: (**) Defines only one value: copy_import or pmtable; if both variables are defined, an error will be shown.

Information about each method is written in the sections below:

Get Dynaform List: GET project/{prj_uid}/dynaforms

Gets the list of Dynaforms in a project.

GET /api/1.0/{workspace}/project/{prj_uid}/dynaforms

Parameters:

NameTypeDescription
workspaceStringWorkspace name
prj_uidStringProject UID

Result:

TypeDescription
arrayReturns an array of Dynaforms objects

Example:

Response

 200 (OK)
 Content-Type: application/json
 [
  {
    "dyn_uid": "2074240775261579834c597006169172",
    "dyn_title": "User data",
    "dyn_description": "User data...",
    "dyn_type": "xmlform"
  },
  {
    "dyn_uid": "84564134152b20cb3efa430060666501",
    "dyn_title": "Demo grid1",
    "dyn_description": "Demo grid1 DESCRIPTION...",
    "dyn_type": "grid"
  },
  {
    "dyn_uid": "17796063752b32090a0e950049957998",
    "dyn_title": "My DynaForm1",
    "dyn_description": "My DynaForm1 DESCRIPTION",
     "dyn_type": "xmlform"
  }
 ]


Get Dynaform: GET project/{prj_uid}/dynaform/{dyn_uid}

Gets a single Dynaform from a project.

GET /api/1.0/{workspace}/project/{prj_uid}/dynaform/{dyn_uid}

Parameters:

NameTypeDescription
workspaceStringWorkspace name
prj_uidStringProject UID
dyn_uidStringDynaform UID

Result:

TypeDescription
objectReturns an array of Dynaform objects

Example:

Response

 200 (OK)
 Content-Type: application/json
 {
    "dyn_uid": "2074240775261579834c597006169172",
    "dyn_title": "User data",
    "dyn_description": "User data...",
    "dyn_type": "xmlform"
 }

Get Field List in Grid: GET project/{prj_uid}/dynaform/{dyn_uid}/grid/{grd_name}/field-definitions

Gets the list of fields found in a specified grid.

GET /api/1.0/{workspace}/project/{prj_uid}/dynaform/{dyn_uid}/grid/{grd_name}/field-definitions

URL Parameters:

NameTypeDescriptionExample
workspaceStringWorkspace name. /api/1.0/workflow/project/798659366573140bc117490080056441/ dynaform/406442383573140df944390011262710/grid/ clientList/field-definitions
prj_uidStringUnique ID of the project, which can be found in the @@PROCESS system variable in the Debugger. /api/1.0/workflow/project/798659366573140bc117490080056441/ dynaform/406442383573140df944390011262710/grid/ clientList/field-definitions
dyn_uidStringUnique ID of the Dynaform that holds the grid, which can be found by clicking on the border of the DynaForm and looking at the id property. /api/1.0/workflow/project/798659366573140bc117490080056441/ dynaform/406442383573140df944390011262710/grid/ clientList/field-definitions
grd_nameStringThe name of the variable which is associated with the grid. Note that it is not possible to retrieve grids that aren't associated with a variable. /api/1.0/workflow/project/798659366573140bc117490080056441/ dynaform/406442383573140df944390011262710/grid/ clientList/field-definitions

Result:

If successful, the HTTP status code is set to 200 and an array of objects is returned, which contain the attributes of the fields in the specified grid. The attributes vary according to the type of field. To learn more, see the Available Attributes of DynaForm controls and Editing DynaForm's JSON code.

Example:

Response

200 (OK)
[
  {
    "type":           "text",
    "variable":       "",
    "var_uid":        "",
    "dataType":       "",
    "protectedValue": false,
    "id":             "clientName",
    "name":           "clientName",
    "label":          "Client Name",
    "defaultValue":   "",
    "placeholder":    "",
    "hint":           "",
    "required":       false,
    "textTransform":  "none",
    ...
  }
  {
    "type":               "datetime",
    "variable":           "",
    "var_uid":            "",
    "dataType":           "",
    "protectedValue":     false,
    "id":                 "contractDate",
    "name":               "contractDate",
    "label":              "Contract Date",
    "placeholder":        "",
    "hint":               "",
    "required":           false,
    "mode":               "parent",
    "format":             "YYYY-MM-DD",
    "dayViewHeaderFormat":"MMMM YYYY",
    "extraFormats":       false,
    "stepping":           1,
    "minDate":            "",
    ...
  }
]

PHP Example:

The following code retrieves the field list for a grid whose variable is named "clientList", and prints a list of the attributes for each field in the grid.

$oToken = pmRestLogin('YOXQRMHAMMMKSOENEDENDFQDTJTGTUUS', '32667560556abe5142235e0090500305', 'mary', 'p@s5w0rD');
if (!isset($oToken) or !isset($oToken->access_token)) {
   die("Error: Can't access ProcessMaker REST");
}

$gridName = 'clientList';
$dynaformId = '406442383573140df944390011262710';
$projectId = '798659366573140bc117490080056441';
$url = "/api/1.0/workflow/project/$projectId/dynaform/$dynaformId/grid/$gridName/field-definitions";

$oRet = pmRestRequest("GET", $url, null, $oToken->access_token);
if ($oRet->status != 200) {
  print_r($oRet);
  die;
}

print "<pre>"; //if displaying in a web page
foreach($oRet->response as $oField) {
   print "{\n";
   foreach($oField as $key => $value) {
      print "  $key => $value\n";
   }
   print "}\n";
}

Get Field in Grid: GET project/{prj_uid}/dynaform/{dyn_uid}/grid/{grd_name}/field-definition/{fld_id}

Gets the attributes of a field in a grid.

GET /api/1.0/{workspace}/project/{prj_uid}/dynaform/{dyn_uid}/grid/{grd_name}/field-definition/{fld_id}

URL Parameters:

NameTypeDescriptionExample
workspaceStringWorkspace name. /api/1.0/workflow/project/798659366573140bc117490080056441/ dynaform/406442383573140df944390011262710/grid/ clientList/field-definition/address
prj_uidStringUnique ID of the project, which can be found in the @@PROCESS system variable in the Debugger. /api/1.0/workflow/project/798659366573140bc117490080056441/ dynaform/406442383573140df944390011262710/grid/ clientList/field-definition/address
dyn_uidStringUnique ID of the Dynaform that holds the grid, which can be found by clicking on the border of the DynaForm and looking at the id property. /api/1.0/workflow/project/798659366573140bc117490080056441/ dynaform/406442383573140df944390011262710/grid/ clientList/field-definition/address
grd_nameStringThe name of the variable which is associated with the grid. Note that it is not possible to retrieve grids that aren't associated with a variable. /api/1.0/workflow/project/798659366573140bc117490080056441/ dynaform/406442383573140df944390011262710/grid/ clientList/field-definition/address
fld_idStringThe id of a field inside a grid./api/1.0/workflow/project/798659366573140bc117490080056441/ dynaform/406442383573140df944390011262710/grid/ clientList/field-definition/address

Result:

If successful, the HTTP status code is set to 200 and an object is returned, which contain the attributes of the grid field. The attributes vary according to the type of field. To learn more, see the Available Attributes of DynaForm controls and Editing DynaForm's JSON code.

Example:

Response

200 (OK)
{
  "type":             "text",
  "variable":         "",
  "var_uid":          "",
  "dataType":         "",
  "protectedValue":   false,
  "id":               "clientName",
  "name":             "clientName",
  "label":            "Client Name",
  "defaultValue":     "",
  "placeholder":      "",
  "hint":             "",
  "required":         false,
  "textTransform":    "none",
  "validate":         "",
  "validateMessage":  "",
  "maxLength":        1000,
  "formula":          "",
  "mode":             "parent",
  "operation":        "",
  "datasource":       "database",
  "dbConnection":     "workflow",
  "dbConnectionLabel":"PM Database",
  "sql":              "",
  "dataVariable":     "",
  "columnWidth":      "30",
  "width":            100,
  "title":            "Client Name"
}

PHP Example:

The following code prints out the attributes of a field with the ID "clientName" found in a grid whose variable is named "clientList".

$oToken = pmRestLogin('YOXQRMHAMMMKSOENEDENDFQDTJTGTUUS', '32667560556abe5142235e0090500305', 'mary', 'p@s5w0rD');
if (!isset($oToken) or !isset($oToken->access_token)) {
   die("Error: Can't access ProcessMaker REST");
}

$gridName = 'clientList';
$fieldId  = 'clientName';
$dynaformId = '406442383573140df944390011262710';
$projectId = '798659366573140bc117490080056441';
$url = "/api/1.0/workflow/project/$projectId/dynaform/$dynaformId/grid/$gridName/field-definition/$fieldId";

$oRet = pmRestRequest("GET", $url, null, $oToken->access_token);

if ($oRet->status == 200) {
   print "<pre>"; //if in web page
   foreach($oRet->response as $key => $value) {
      "$key => $value\n";
   }
}

Create Dynaform: POST project/{prj_uid}/dynaform

Normal creation of a DynaForm.

Permission:

Users must have the PM_FACTORY permission assigned to their role to perform this action.

Structure:

POST /api/1.0/{workspace}/project/{prj_uid}/dynaform

Parameters:

NameTypeDescription
workspaceStringWorkspace name
prj_uidStringProject UID

Required Fields:

NameTypeDescription
dyn_titleStringDynaform title
dyn_typeStringDynaform type
dyn_versionIntegerDynaform version

Optional Fields:

NameTypeDescription
dyn_descriptionStringDynaform description
dyn_contentStringDynaform content

Result:

TypeDescription
objectReturns an object that contains information about the new Dynaform and the attribute: "dyn_uid"

Example:

Request

 Content-Type: application/json
 {
    "dyn_title": "My DynaForm1",
    "dyn_description": "My DynaForm1 DESCRIPTION",
    "dyn_type": "xmlform"
 }

Response

 201 (Created)
 {
    "dyn_uid": "17796063752b32090a0e950049957998",
    "dyn_title": "My DynaForm1",
    "dyn_description": "My DynaForm1 DESCRIPTION",
    "dyn_type": "xmlform"
 }


Create Dynaform from Copy/Import: POST project/{prj_uid}/dynaform

Creates a Dynaform using Copy/Import.

Permission:

Users must have the PM_FACTORY permission assigned to their role to perform this action.

Structure:

POST /api/1.0/{workspace}/project/{prj_uid}/dynaform

Parameters:

NameTypeDescription
workspaceStringWorkspace name
prj_uidStringProject UID

Required Fields:

NameTypeDescription
dyn_titleStringDynaform title
dyn_versionIntegerDynaform version
copy_importStringDynaform data to Copy/Import
copy_import . prj_uidStringProject UID
copy_import . dyn_uidStringDynaform UID

Optional Fields:

NameTypeDescription
dyn_descriptionStringDynaform description
dyn_contentStringDynaform content

Result:

TypeDescription
objectReturns an object that contains information about the new Dynaform and the attribute: "dyn_uid"

Example:

Request

 Content-Type: application/json
 {
    "dyn_title": "My DynaForm1",
    "dyn_description": "My DynaForm1 DESCRIPTION",
    "dyn_type": "xmlform",
    "copy_import":
    {
      "prj_uid": "7389179125176dac806d205065699622",
      "dyn_uid": "77941473952b49c65a01a80041727578"
    }
 }

Response

 201 (Created)
 {
    "dyn_uid": "17796063752b32090a0e950049957998",
    "dyn_title": "My DynaForm1",
    "dyn_description": "My DynaForm1 DESCRIPTION",
    "dyn_type": "xmlform"
 }


Create Dynaform from PM Table: POST project/{prj_uid}/dynaform

Creates a Dynaform using the fields in a PM table.

Permission:

Users must have the PM_FACTORY permission assigned to their role to perform this action.

Structure:

POST /api/1.0/{workspace}/project/{prj_uid}/dynaform

Parameters:

NameTypeDescription
workspaceStringWorkspace name
prj_uidStringProject UID

Required Fields:

NameTypeDescription
dyn_titleStringDynaform title
dyn_versionIntegerDynaform version
pmtableobjectPM Table data
pmtable . tab_uidStringPM Table UID
pmtable . fieldsobjectDefinition of the primary key to register in the PM Table

Optional Fields:

NameTypeDescription
dyn_descriptionStringDynaform description
dyn_contentStringDynaform content

Result:

TypeDescription
objectReturns an object that contains information about the new Dynaform and the attribute: "dyn_uid"

Example:

Request

 Content-Type: application/json
 {
   "dyn_title": "My DynaForm1",
   "dyn_description": "My DynaForm1 DESCRIPTION",
   "dyn_type": "xmlform",
   "pmtable":
   {
     "tab_uid": "72249773552b84ded1d8aa4036518645",
      "fields": [
               {
                     "fld_name": "ID",
                     "pro_variable": "@#APPLICATION"
               }
                ]
   }
 }

Response

 201 (Created)
 {
    "dyn_uid": "17796063752b32090a0e950049957998",
    "dyn_title": "My DynaForm1",
    "dyn_description": "My DynaForm1 DESCRIPTION",
    "dyn_type": "xmlform"
 }


Update Dynaform: PUT project/{prj_uid}/dynaform/{dyn_uid}

Updates a Dynaform in a project.

Permission:

Users must have the PM_FACTORY permission assigned to their role to perform this action.

Structure:

PUT /api/1.0/{workspace}/project/{prj_uid}/dynaform/{dyn_uid}

Parameters:

NameTypeDescription
workspaceStringWorkspace name
prj_uidStringProject UID
dyn_uidStringDynaform UID

Optional Fields:

NameTypeDescription
dyn_titleStringDynaform title
dynaform_descriptionStringDynaform description
dyn_typeStringDynaform type
dyn_versionIntegerDynaform version
dyn_contentStringDynaform content

Result:

TypeDescription
emptyNo return

Example:

Request

 Content-Type: application/json
 {
    "dyn_title": "My DynaForm1…",
    "dyn_description": "My DynaForm1 DESCRIPTION…",
    "dyn_type": "xmlform"
 }

Response

 200 (OK)


Delete Dynaform: DELETE project/{prj_uid}/dynaform/{dyn_uid}

Deletes a Dynaform in a project.

Permission:

Users must have the PM_FACTORY permission assigned to their role to perform this action.

Structure:

DELETE /api/1.0/{workspace}/project/{prj_uid}/dynaform/{dyn_uid}

Parameters:

NameTypeDescription
workspaceStringWorkspace name
prj_uidStringProject UID
dyn_uidStringDynaform UID

Result:

TypeDescription
emptyNo return

Example:

Response

 200 (OK)