Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Best practice for creating APIs in AEM

Avatar

Avatar
Boost 25
Level 4
TB3dock
Level 4

Likes

28 likes

Total Posts

181 posts

Correct Reply

4 solutions
Top badges earned
Boost 25
Give Back 25
Validate 10
Validate 1
Ignite 5
View profile

Avatar
Boost 25
Level 4
TB3dock
Level 4

Likes

28 likes

Total Posts

181 posts

Correct Reply

4 solutions
Top badges earned
Boost 25
Give Back 25
Validate 10
Validate 1
Ignite 5
View profile
TB3dock
Level 4

22-03-2021

In Java projects, one would usually use spring boot, and generate versioned apis from annotated controllers and models and use swagger to test/document.  APIs would include customer login, registration, edit details, get order history etc.  Some calls search and return content, e.g using sql2 and some will hit back ends behind aem.  They would use Json. 

 

while we could hand write servlets which manually unmarshal and marshal request and response objects, this would be like going back to the 80s.

 

Does aem have a recommended way to create versioned apis for the front end to consume, with built in documentation generation?

 

I saw there is a swagger aem project, but not sure how this would work with aem not being spring or mvc

 

i understand that aem uses sling, but I haven’t found a tutorial on how this might be used, and the sling servlet reference docs don’t seem to have a way to specify the actual type of the request and response other than as SlingHttpServletRequest and SlingHttpServletResponse, which require writing your own get param extraction and writing your own json out (vs something which takes a java object and constructs the json for you). I haven’t seen something like swagger for it?  

 

View Entire Topic

Avatar

Avatar
Validate 1
Level 7
KiranVedantam1992
Level 7

Likes

159 likes

Total Posts

159 posts

Correct Reply

47 solutions
Top badges earned
Validate 1
Establish
Give Back 3
Give Back
Boost 50
View profile

Avatar
Validate 1
Level 7
KiranVedantam1992
Level 7

Likes

159 likes

Total Posts

159 posts

Correct Reply

47 solutions
Top badges earned
Validate 1
Establish
Give Back 3
Give Back
Boost 50
View profile
KiranVedantam1992
Level 7

23-03-2021