How to display in adaptive form data returned as array from REST API

Avatar

Avatar
Boost 1
Level 1
sashia16734439
Level 1

Like

1 like

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
sashia16734439
Level 1

Like

1 like

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
sashia16734439
Level 1

05-02-2020

Hi,

I was successfully able to return a single entity object from a REST API with a swagger definition and display the data in an adaptive form, but I want to know how I can display an array. AEM is not able to process the swagger definition for an array or map. I tried few combinations, can someone give me an example swagger definition of an REST endpoint which works with AEM data model. I am trying not to write code to do the same as I want it to make it easy for me to add endpoints at will and form authors should be able to just use it to populate a drop-down list on the adaptive form.

 

Appreciate the help. Thanks.

Accepted Solutions (0)

Answers (3)

Answers (3)

Avatar

Avatar
Ignite 5
Employee
workflowuser
Employee

Likes

143 likes

Total Posts

446 posts

Correct reply

70 solutions
Top badges earned
Ignite 5
Ignite 3
Ignite 1
Give Back 50
Give Back 5
View profile

Avatar
Ignite 5
Employee
workflowuser
Employee

Likes

143 likes

Total Posts

446 posts

Correct reply

70 solutions
Top badges earned
Ignite 5
Ignite 3
Ignite 1
Give Back 50
Give Back 5
View profile
workflowuser
Employee

15-02-2020

Your swagger file needs to define an array of objects. You can then map the objects in Adaptive Forms. In the form data model make sure you have selected return array of objects settings

Avatar

Avatar
Boost 1
Level 1
sashia16734439
Level 1

Like

1 like

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
sashia16734439
Level 1

Like

1 like

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
sashia16734439
Level 1

13-02-2020

I created a top level object which nested the array I wanted and I was able to solve the issue like this. AEM Forms data model does not seem to recognize the array defined in the schema at the top level from what I can tell. Good thing is that now I am able to get my data and use it in forms without any custom code to call an RESTfull API.  

Avatar

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

327 likes

Total Posts

1,150 posts

Correct reply

185 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

327 likes

Total Posts

1,150 posts

Correct reply

185 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile
Mayank_Gandhi
Level 10

10-02-2020

Hi,

 

Are you already getting the array?