用于在表单门户上处理已提交表单的API apis-to-work-with-submitted-forms-on-forms-portal

CAUTION
AEM 6.4已结束扩展支持,本文档将不再更新。 有关更多详细信息,请参阅 技术支助期. 查找支持的版本 此处.

AEM Forms提供了API,您可以使用这些API查询通过表单门户提交的表单数据。 此外,您还可以使用本文档中介绍的API发布评论或更新已提交表单的属性。

NOTE
必须将调用API的用户添加到审阅人组,如 将提交审阅人关联到表单.

GET/content/forms/portal/submission.review.json?func=getFormsFormsSubmissionReview get-content-forms-portal-submission-review-json-func-getformsforsubmissionreview-br

返回所有符合条件的表单的列表。

URL参数 url-parameters

此API不需要其他参数。

响应 response

响应对象包含一个JSON数组,其中包含表单名称及其存储库路径。 响应的结构如下:

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

示例 example

请求 URL

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

响应

[{"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

返回所有已提交表单的详细信息。 但是,您可以使用URL参数来限制结果。

URL参数 url-parameters-1

在请求URL中指定以下参数:

参数
描述
formPath
指定表单所在的CRX存储库路径。 如果未指定表单路径,则返回空响应。
offset (可选)
在结果集的索引中指定起点。 默认值为 0.
limit (可选)
限制结果数量。 默认值为 30.
orderby
(可选)
指定对结果进行排序的属性。 默认值为 jcr:lastModified,根据上次修改时间对结果进行排序。
sort
(可选)
指定对结果进行排序的顺序。 默认值为 desc,则会按降序排序。 您可以指定 asc 以升序排序结果。
cutPoints
(可选)
指定要包含在结果中的表单属性列表(以逗号分隔)。 默认属性为:
formName, formPath, submitID, formType, jcr:lastModified, owner
search
(可选)
在表单属性中搜索指定的值,并返回具有匹配值的表单。 默认值为 "".

响应 response-1

响应对象包含一个JSON数组,其中包含指定表单的详细信息。 响应的结构如下:

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

示例 example-1

请求 URL

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

响应

{"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

向指定的提交实例添加注释。

URL参数 url-parameters-2

在请求URL中指定以下参数:

参数
描述
submitID
指定与提交实例关联的元数据ID。
Comment
指定要添加到指定提交实例的注释文本。

响应 response-2

在成功发布评论时返回评论ID。

示例 example-2

请求 URL

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

响应

1403873422601300

GET/content/forms/portal/submission.review.json?func=getComments   get-content-forms-portal-submission-review-json-func-getcomments-nbsp

返回在指定的提交实例上发布的所有评论。

URL参数 url-parameters-3

在请求URL中指定以下参数:

参数
描述
submitID
指定提交实例的元数据ID。

响应 response-3

响应对象包含一个JSON数组,其中包含与指定提交ID关联的所有注释。 响应的结构如下:

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

示例 example-3

请求 URL

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

响应

[{"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

更新指定提交表单实例的指定属性的值。

URL参数 url-parameters-4

在请求URL中指定以下参数:

参数
描述
submitID
指定与提交实例关联的元数据ID。
property
指定要更新的表单属性。
value
指定要更新的表单属性的值。

响应 response-4

返回包含有关已发布更新的信息的JSON对象。

示例 example-4

请求 URL

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

响应

{"formName":"form2","owner":"admin","jcr:lastModified":1446727516593,"path":"/content/forms/fp/admin/submit/metadata/1403037413508500.html","submitID":"1403037413508500","status":"submitted"}
recommendation-more-help
a6ebf046-2b8b-4543-bd46-42a0d77792da