Headless enonic - QraphQL get data from Angular

Enonic version: 7.3

Hello all,

We have an Enonic headless application - assume Headless CMS starter. We want to have a frontend client application written in Angular. Can you, please show me how to select the data in Angular application using GraphQL?

I know there is the Accessing API (http://localhost:8080/site/default/draft/hmdb/api) provided by Enonic, where you can test the queries. But how to get data from Angular?
What URL shall we connect to?
Do we need some GraphQL package, like Apollo installed in Angular?

Thank you for your help. I would appreciate a practical example :-).

Practical example is already in your possession, if you have an application based upon Headless CMS starter. Your application implements an endpoint (like http://localhost:8080/site/default/draft/hmdb/api that you mentioned) which the client-side of your app will connect to to fetch the data.

If you want more advanced example, you can look at the Office League app. This one is actually built with Angular 2, which is a bit outdated but is still very close to what you need.

Thank you asa, for the answer. We finally get it working! One of the problem was that we didn’t have set permissions for the client in enonic xp. When we set permission of our application for Everyone for read in XP, then it works fine.
Thank you for hint

3 Likes