You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 18 Next »

Definition

Form API can interact with form data of the specified form.

This API is based on the current app context based on the specified form.


NameDescription
1Form

Select any form present in the current app, for interaction with API.

2Short Description

Any description here.

3Ignore Form Permission

Check this option to ignore form & form section permission for current user when storing/retrieving form data.

4

Add form data

Add a new record to the specified form.

Name

Description
URL/form/*yourFormId*
HTTP MethodPOST
Body Parameters

The parameters required here is highly dependent on the form data schema of the specified form.

For example, for "Expense Claim Form" in Expenses Claim app found in most default Joget installations, it may look like this:

{
  "id": "string",
  "sfD": {
    "ref": "string",
    "title": "string",
    "remark": "string",
    "SelectApprover": "string",
    "claimant": "string",
    "username": "string",
    "status": "string",
    "id": "string"
  },
  "spECD": [
    {
      "id": "string",
      "category": "string",
      "date": "string",
      "purpose": "string",
      "amount": "string"
    }
  ],
  "total": "string",
  "receipt": "string",
  "CreatedDate": "string",
  "dateCreated": "2019-08-28",
  "dateModified": "2019-08-28",
  "createdBy": "string",
  "createdByName": "string",
  "modifiedBy": "string",
  "modifiedByName": "string"
}
Sample Response

A uniquely generated form record ID will be returned as the success response.

{
  "id": "d6cc05e4-c0a86310-60e35ca0-9dd035a0",
  "errors": {}
}
5

Add form data with file upload

Add a new record to the specified form.
NameDescription
URL                                            /form/*yourFormId*/addWithFiles
HTTP MethodPOST 
Body Parameters

The parameters required here is highly dependent on the form data schema of the specified form. A uniquely generated form record ID will be returned as the success response.

Sample Response

A uniquely generated form record ID will be returned as the success response.

{
  "id": "cd0f9c53-1e08-437f-868a-c8a76a9fad7f",
  "errors": {}
}
6

Delete form data

Delete a record of the specified form, via record ID.

Name

Description
URL/form/*yourFormId*/{recordId}
HTTP MethodDELETE
Path Parameters
ParameterDescription
recordIdForm record ID.
Sample Response
{
  "date": "Wed Aug 28 14:07:37 SGT 2019",
  "code": "200",
  "message": "Successful operation"
}
7

Download all uploaded files in zip

Download all uploaded file in zip by record id & field id

NameDescription
URL/form/*yourFormId*/{recordId}/{fieldId}/files                                                                                                                  
HTTP MethodGET
Path Parameters      
ParameterDescription
recordIdForm Record ID
fieldIdUpload Field ID
Sample Response   

A link will appear for you to download the file that you have specified 

8

Download uploaded file

Download uploaded file by record id & file name

NameDescription
URL/form/*yourFormId*/{recordId}/download/{fileName}   
HTTP MethodGET
Path Parameters
ParameterDescription
recordIdForm record ID
fileNameFile name to be download
Query String Parameters
ParameterDescription
attachmentSet the file as attachment
Sample Response

A link will appear for you to download the file that you have specified



9

Get form data by record ID

Retrieve data of a record from the specified form, via record ID.

Name

Description
URL/form/*yourFormId*/{recordId}
HTTP MethodGET
Path Parameters
ParameterDescription
recordIdForm record ID.
Query String Parameters
ParameterDescription
includeSubformDataInclude all subform(s) data present in the specified form, into the response.
includeReferenceElements

Include all referenced elements present in the specified form, into the response.

(e.g: select box element referencing a datalist record)

flattenDataOption to flatten all JSON objects to a single-level key-value map.
Sample Response
{
  "createdByName": "Admin Admin",
  "dateModified": "2019-08-15 15:43:35.0",
  "remark": "",
  "title": "Spend everything",
  "SelectApprover": "admin",
  "ref": "0001",
  "total": "0.00",
  "modifiedByName": "Admin Admin",
  "dateCreated": "2019-04-25 20:14:28.0",
  "createdBy": "admin",
  "CreatedDate": "2019-08-15",
  "modifiedBy": "admin",
  "receipt": "",
  "id": "44_expenseclaim_process1",
  "claimant": "Admin Admin",
  "status": "Submitted",
  "username": "admin"
}
10

Update form data

Update a record of the specified form.

Name

Description
URL/form/*yourFormId*
HTTP MethodPUT
Body Parameters

The parameters required here is highly dependent on the form data schema of the specified form.

The record ID specified must be of an existing record of the form, to update its records successfully.

Sample Response
The same form record ID as specified in the body parameters will be returned as the success response.


{
  "id": "d6cc05e4-c0a86310-60e35ca0-9dd035a0",
  "errors": {}
}
11

Update form data with file upload

Update a record of the specified form.

NameDescription
URL           /form/*yourFormId*/updateWithFiles
HTTP MethodPOST                                                                                                                                       
Body Parameters

The parameters required here is highly dependent on the form data schema of the specified form.

The record ID specified must be of an existing record of the form, to update its records successfully.

The same form record ID as specified in the body parameters will be returned as the success response.

Sample Response

The same form record ID as specified in the body parameters will be returned as the success response.


{
  "id": "d6cc05e4-c0a86310-60e35ca0-9dd035a0",
  "errors": {}
}




  • No labels