APIs to work with submitted forms on forms portal
- Topics:
- Forms Portal
CREATED FOR:
- User
- Developer
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
Returns a list of all eligible forms.
URL parameters
This API does not 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:
formPath
offset
(optional)
limit
(optional)
orderby
(optional)
sort
(optional)
asc
to sort results in ascending order.cutPoints
(optional)
formName
, formPath
, submitID
, formType
, jcr:lastModified
, owner
search
(optional)
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:
submitID
Comment
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:
submitID
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:
submitID
property
value
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"}