APIs to work with submitted forms on forms portal

CAUTION

AEM 6.4 has reached the end of extended support and this documentation is no longer updated. For further details, see our technical support periods. Find the supported versions here.

AEM Forms provides APIs that you can use to query forms data submitted through forms portal. In addition, you can post comments or update properties of submitted forms using the APIs explained in this document.

NOTE

Users who will invoke the APIs must be added to the reviewers group as described in Associating submission reviewers to a form.

GET /content/forms/portal/submission.review.json?func=getFormsForSubmissionReview

Returns a list of all eligible forms.

URL parameters

This API doesn’t require additional parameters.

Response

The response object contains a JSON array that includes forms names and their repository path. The structure of the response is as follows:

[
 {formName: "<form name>",
 formPath: "<path to the form>" },
 {.....},
 ......]

Example

Request URL

https://[host]:[port]/content/forms/portal/submission.review.json?func=getFormsForSubmissionReview

Response

[{"formPath":"/content/dam/formsanddocuments/forms-review/form2","formName":"form2"},{"formPath":"/content/dam/formsanddocuments/forms-review/form1","formName":"form1"}]

GET /content/forms/portal/submission.review.json?func=getAllSubmissions

Returns details of all submitted forms. However, you can use URL parameters to limit the results.

URL parameters

Specify the following parameters in the request URL:

Parameter Description
formPath Specifies the CRX repository path where the form resides. If you do not specify the form path, it returns an empty response.
offset
(optional)
Specifies the starting point in the index of the results set. The default value is 0.
limit
(optional)
Limits the number of results. The default value is 30.
orderby
(optional)
Specifies the property for sorting results. The default value is jcr:lastModified, which sorts results based on the last modified time.
sort
(optional)
Specifies the order for sorting results. The default value is desc, which sorts results in descending order. You can specify asc to sort results in ascending order.
cutPoints
(optional)
Specifies a comma-separated list of form properties to be included in results. The default properties are:
formName, formPath, submitID, formType, jcr:lastModified, owner
search
(optional)
Searches the specified value in form properties and returns forms with matching values. The default value is "".

Response

The response object contains a JSON array that includes details of the specified forms. The structure of the response is as follows:

{
 total: "<total number of submissions>",
 items: [{ formName: "<name of the form>", formPath: "<path to the form>", owner: "<owner of the form>"},
 ....]}

Example

Request URL

https://[host]:[port]/content/forms/portal/submission.review.json?func=getAllSubmissions&formPath=/content/dam/formsanddocuments/forms-review/form2

Response

{"total":1,"items":[{"formName":"form2","formPath":"/content/dam/formsanddocuments/forms-review/form2","submitID":"1403037413508500","formType":"af","jcr:lastModified":"2015-11-05T17:52:32.243+05:30","owner":"admin"}]}

POST /content/forms/portal/submission.review.json?func=addComment

Adds a comment to the specified submission instance.

URL parameters

Specify the following parameters in the request URL:

Parameter Description
submitID Specifies the metadata ID associated with a submission instance.
Comment Specifies the text for comment to add to the specified submission instance.

Response

Returns a comment ID on successful posting of a comment.

Example

Request URL

https://[host:[port]/content/forms/portal/submission.review.json?func=addComment&submitID=1403037413508500&comment=API+test+comment

Response

1403873422601300

GET /content/forms/portal/submission.review.json?func=getComments  

Returns all comments posted on the specified submission instance.

URL parameters

Specify the following parameter in the request URL:

Parameter Description
submitID Specifies the metadata ID of a submission instance.

Response

The response object contains a JSON array that includes all comments associated with the specified submission ID. The structure of the response is as follows:

[{
 owner: "<name of the commenter>",
 comment: "<comment text>",
 time: "<time when the comment was posted>"},
 { }......]

Example

Request URL

https://[host]:[port]/content/forms/portal/submission.review.json?func=getComments&submitID=1403037413508500

Response

[{"owner":"fr1","comment":"API test comment","time":1446726988250}]

POST /content/forms/portal/submission.review.json?func=updateSubmission

Updates the value of the specified property of the specified submitted form instance.

URL parameters

Specify the following parameters in the request URL:

Parameter Description
submitID Specifies the metadata ID associated with a submission instance.
property Specifies the form property to be updated.
value Specifies the value of the form property to be updated.

Response

Returns a JSON object with information about the update posted.

Example

Request URL

https://[host]:[port]/content/forms/portal/submission.review.json?func=updateSubmission&submitID=1403037413508500&value=sample_value&property=some_new_prop

Response

{"formName":"form2","owner":"admin","jcr:lastModified":1446727516593,"path":"/content/forms/fp/admin/submit/metadata/1403037413508500.html","submitID":"1403037413508500","status":"submitted"}

On this page