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