Listing forms on a web page using APIs
CREATED FOR:
- User
AEM Forms provides a REST-based search API that web developers can use to query and retrieve a set of forms that meets the search criteria. You can use APIs to search forms based on various filters. The response object contains form attributes, properties, and render end points of forms.
To search forms using the REST API, send a GET request to the server at https://[server]:[port]/libs/fd/fm/content/manage.json
with query parameters described below.
Query parameters
Attribute name | Description |
func |
Specifies the function to call. To search forms, set value of the For example,
Note: This parameter is mandatory. |
appPath |
Specifies the application path to search for forms. By default, the appPath attribute searches all the applications available at the root node level. You can specify multiple application paths in a single search query. Separate multiple paths with pipe (|) character. |
cutPoints |
Specifies the properties to fetch with the assets. You can use asterisk (*) to fetch all the properties at once. Use the pipe (|) operator to specify multiple properties. For example, Note:
|
relation |
Specifies the related assets to fetch along with the search results. You can choose one of the following options to fetch related assets:
|
maxSize | Specifies the maximum number of forms to fetch. |
offset | Specifies the number of forms to skip from the start. |
returnCount | Specifies whether to return the search results that match the given criteria or not. |
statements |
Specifies the list of statements. The queries are executes on the list of the statements specified in the JSON format. For example,
In the above example,
|
orderings |
Specifies the order criteria for the search results. The criteria is defined in the JSON format. You can sort search results on more than one field. The results are sorted in the order as the fields appear in the query. For example, To retrieve query results ordered by title property in the ascending order, add following parameter:
|
includeXdp | Specifies whether to retrieve the binary content or not. The includeXdp attribute is applicable for assets of type FORM , PDFFORM , and PRINTFORM . |
assetType | Specifies the asset types to retrieve from all the published assets. Use the pipe (|) operator to specify multiple asset types. Valid asset types are FORM, PDFFORM, PRINTFORM, RESOURCE, and GUIDE. |
Sample request
func : searchForms
appPath : /content/dam/formsanddocuments/MyApplication23
cutPoints : title|description|author|status|creationDate|lastModifiedDate|activationDate|expiryDate|tags|allowedRenderFormat|formmodel
relation : NO_RELATION
includeXdp : false
maxSize : 10
offset : 0
returnCount : true
statements: [{"name":"name","value":"*Claim.xdp","operator":"CONTAINS"},
{"name":"","value":"Expense","operator":"FULLTEXT"},
{"name":"description","value":"ABCD*","operator":"CONTAINS"},
{"name":"status","value":"false","operator":"EQ"},
{"name":"lastModifiedDate","value":"01/09/2013","operator":"GTEQ"},
{"name":"lastModifiedDate","value":"01/18/2013","operator":"LTEQ"}]
orderings:[{"name" :“lastModifiedDate“:”order”:”ASC”}]
Sample response
[
{"resultCount":2},
{"assetType":"FORM","name":"ExpenseClaim.xdp","id":"509fa2d5-e3c9-407b-b8dc-fa0ba08eb0ce",
"path":"/content/dam/formsanddocuments/MyApplication23/1.0/ExpenseClaim.xdp",
"title":"Expense Report","description":"ABCDEFGIJK","author":"Frank Bowman",
"tags":[],"formUrl":"/content/dam/formsanddocuments/MyApplication23/1.0/ExpenseClaim.xdp/jcr:content",
"pdfUrl":"/content/dam/formsanddocuments/MyApplication23/1.0/ExpenseClaim.xdp/jcr:content?type=pdf",
"references":[],"images":[{"assetType":"resource","name":"Image.gif","id":"5477a127-8bbf-4cec-8f81-2689e5cb4a15",
"path":"/content/dam/formsanddocuments/MyApplication23/1.0/Image.gif","resourceSize":0}],
"status":false,"creationDate":1358429845623,"lastModifiedDate":1358429846771},
{"assetType":"FORM","name":"ExpenseClaim.xdp","id":"4312239b-b666-4d36-95bc-641b3a39ddd4",
"path":"/content/dam/formsanddocuments/MyApplication23/ExpenseClaim.xdp",
"title":"Expense Report","description":"ABCDefghijklm","author":"Frank Bowman",
"tags":[],"formUrl":"/content/dam/formsanddocuments/MyApplication23/ExpenseClaim.xdp/jcr:content",
"pdfUrl":"/content/dam/formsanddocuments/MyApplication23/ExpenseClaim.xdp/jcr:content?type=pdf",
"references":[],"images":[{"assetType":"resource","name":"Image.gif","id":"118a2e3f-7097-4d8c-85d1-651306de284a",
"path":"/content/dam/formsanddocuments/MyApplication23/Image.gif","resourceSize":0}],"status":false,
"creationDate":1358429856690,"lastModifiedDate":1358430109023}
]
Related Articles
- Enable forms portal components
- Create forms portal page
- List forms on a web page using APIs
- Use Drafts and submissions component
- Customize storage of drafts and submitted forms
- Sample for integrating drafts & submissions component with database
- Customizing templates for forms portal components
- Introduction to publishing forms on a portal