APIs to work with submitted forms on forms portal apis-to-work-with-submitted-forms-on-forms-portal
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.
GET /content/forms/portal/submission.review.json?func=getFormsForSubmissionReview get-content-forms-portal-submission-review-json-func-getformsforsubmissionreview-br
Returns a list of all eligible forms.
URL parameters url-parameters
This API doesn’t require additional parameters.
Response 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 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 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 url-parameters-1
Specify the following parameters in the request URL:
Response response-1
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 example-1
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 post-content-forms-portal-submission-review-json-func-addcomment-br
Adds a comment to the specified submission instance.
URL parameters url-parameters-2
Specify the following parameters in the request URL:
submitID
Comment
Response response-2
Returns a comment ID on successful posting of a comment.
Example example-2
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 get-content-forms-portal-submission-review-json-func-getcomments-nbsp
Returns all comments posted on the specified submission instance.
URL parameters url-parameters-3
Specify the following parameter in the request URL:
submitID
Response response-3
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 example-3
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 post-content-forms-portal-submission-review-json-func-updatesubmission-br
Updates the value of the specified property of the specified submitted form instance.
URL parameters url-parameters-4
Specify the following parameters in the request URL:
submitID
property
value
Response response-4
Returns a JSON object with information about the update posted.
Example example-4
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"}