REST API - Map a Sling servlet to a path with a variable part
Hi masters!
I am going to implement a REST API in AEM to integrate 3rd party applications.
I do not want to rely in the JCR repository hierarchy, because my internal hierarchy does not matter to the 3rd party applications. So, I do not want to map my Sling servlets to a resourceType (that would mean to specify the path to the resource, so using the JCR hierarchy).
So, I need to map the servlets to a path.
Following the REST API development best practices, I should use a path like ‘/api/v1/articles’ to implement operations like search and create new article (with GET and POST HTTP methods), and a path like ‘/api/v1/articles/<article_id>’ to implement operations like get details and modify a specific article (also with GET and POST HTTP methods).
My question is, is it possible to map Sling servlets to a paths like those, where the <article_id> is variable?
‘/api/v1/articles’
‘/api/v1/articles/<article_id>’
Thank you masters!
J.



