AEM Forms提供了可用于查询通过表单门户提交的表单数据的API。 此外,您还可以使用本文档中介绍的API发布注释或更新已提交表单的属性。
必须将将调用API的用户添加到审阅者组中,如中所述 将提交审阅者与表单关联.
返回所有符合条件的表单的列表。
此API不需要其他参数。
响应对象包含一个JSON数组,其中包含表单名称及其存储库路径。 响应结构如下:
[
{formName: "<form name>",
formPath: "<path to the form>" },
{.....},
......]
请求 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"}]
返回所有已提交表单的详细信息。 但是,您可以使用URL参数来限制结果。
在请求URL中指定以下参数:
参数 | 描述 |
---|---|
formPath |
指定表单所在的CRX存储库路径。 如果不指定表单路径,则会返回空响应。 |
offset (可选) |
指定结果集索引中的起点。 默认值为 0. |
limit (可选) |
限制结果的数量。 默认值为 30. |
orderby (可选) |
指定用于排序结果的属性。 默认值为 jcr:lastModified,根据上次修改时间对结果进行排序。 |
sort (可选) |
指定排序结果的顺序。 默认值为 desc,以降序对结果进行排序。 您可以指定 asc 以按升序对结果进行排序。 |
cutPoints (可选) |
指定要包含在结果中的表单属性的逗号分隔列表。 默认属性为:formName , formPath , submitID , formType , jcr:lastModified , owner |
search (可选) |
在表单属性中搜索指定的值并返回具有匹配值的表单。 默认值为 "". |
响应对象包含一个JSON数组,其中包含指定表单的详细信息。 响应结构如下:
{
total: "<total number of submissions>",
items: [{ formName: "<name of the form>", formPath: "<path to the form>", owner: "<owner of the form>"},
....]}
请求 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"}]}
向指定的提交实例添加注释。
在请求URL中指定以下参数:
参数 | 描述 |
---|---|
submitID |
指定与提交实例关联的元数据ID。 |
Comment |
指定要添加到指定提交实例的注释文本。 |
在成功发布评论时返回评论ID。
请求 URL
https://[host:'port'/content/forms/portal/submission.review.json?func=addComment&submitID=1403037413508500&comment=API+test+comment
响应
1403873422601300
返回在指定的提交实例上发布的所有注释。
在请求URL中指定以下参数:
参数 | 描述 |
---|---|
submitID |
指定提交实例的元数据ID。 |
响应对象包含一个JSON数组,该数组包含与指定的提交ID关联的所有注释。 响应结构如下:
[{
owner: "<name of the commenter>",
comment: "<comment text>",
time: "<time when the comment was posted>"},
{ }......]
请求 URL
https://[host]:'port'/content/forms/portal/submission.review.json?func=getComments&submitID=1403037413508500
响应
[{"owner":"fr1","comment":"API test comment","time":1446726988250}]
更新指定提交的表单实例的指定属性的值。
在请求URL中指定以下参数:
参数 | 描述 |
---|---|
submitID |
指定与提交实例关联的元数据ID。 |
property |
指定要更新的表单属性。 |
value |
指定要更新的表单属性的值。 |
返回一个包含有关已发布更新的信息的JSON对象。
请求 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"}