Consuming GraphlQL endpoint AEM internally (backend)
Hey community!
I´m currently playing around with the GraphQL functionality based on content fragment models and persistent queries. I understand the external use cases to consume this data in an AEM frontend or any other system / third party application.
I have a scenario where I want to use the existing content fragment data in the AEM backend and provide it to e.g. a component model via an OSGi service. The most obvious option was to create a service and make REST calls against the GraphQL endpoint of the current instance and use the persistent queries function. That looks quite nice (and works in a development environment), but in the end I have to deal with the following circumstances:
1. On which environment is my code running? Which is the domain I need to query?
2. If I want to query the author instances, I need to authenticate my request, because the OSGi service does not know anything about a users request or any other authenticated resource.
At the moment we need custom code to fetch data from the content fragment area and care about transforming, filtering and so on. With the flexible GraphQL queries and the ability to just map the results to objects it would be pretty easy and flexible to work with that data.
Is that a use case that was considered for headless? I can imagine that this is covered with the logic implemented for the CIF framework, but since we are not yet using this functionality it is not available in our environment.
Any help or input is highly appreciated!
Thanks and best
Alex