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 |
指定要更新的form屬性。 |
value |
指定要更新的form屬性的值。 |
傳回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"}