Manage GraphQL endpoints in AEM graphql-aem-endpoint
The endpoint is the path used to access GraphQL for AEM. Using this path you (or your app) can:
- access the GraphQL schema,
- send your GraphQL queries,
- receive the responses (to your GraphQL queries).
There are two types of endpoints in AEM:
-
Global
- Available for use by all sites.
- This endpoint can use all Content Fragment Models from all Sites configurations (defined in the Configuration Browser).
- If there are any Content Fragment Models that should be shared among Sites configurations, then these should be created under the global Sites configurations.
-
Sites configurations:
- Corresponds to a Sites configuration, as defined in the Configuration Browser.
- Specific to a specified site/project.
- A Sites configuration specific endpoint will use the Content Fragment Models from that specific Sites configuration together with those from the global Sites configuration.
The repository path of the GraphQL for AEM global endpoint is:
/content/cq:graphql/global/endpoint
For which your app can use the following path in the request URL:
/content/_cq_graphql/global/endpoint.json
To enable an endpoint for GraphQL for AEM you need to:
Enabling your GraphQL Endpoint enabling-graphql-endpoint
To enable a GraphQL Endpoint you first need to have an appropriate configuration. See Content Fragments - Configuration Browser.
To enable the corresponding endpoint:
-
Navigate to Tools, Assets, then select GraphQL.
-
Select Create.
-
The Create new GraphQL Endpoint dialog box opens. Here you can specify:
- Name: name of the endpoint; you can enter any text.
- Use GraphQL schema provided by: use the dropdown to select the required site/project.
note note NOTE The following warning is shown in the dialog box: - GraphQL endpoints may introduce data security and performance issues if not managed carefully. Please ensure to set appropriate permissions after creating an endpoint.
-
Confirm with Create.
-
The Next steps dialog will provide a direct link to the Security console so that you can ensure that newly created endpoint has suitable permissions.
note caution CAUTION The endpoint is accessible to everyone. This can - especially on publish instances - pose a security concern, as GraphQL queries can impose a heavy load on the server. You can set up ACLs, appropriate to your use case, on the endpoint.
Publishing your GraphQL Endpoint publishing-graphql-endpoint
Select the new endpoint and Publish to make it fully available in all environments.