![]() ![]() To manage the cache globally, you can configure the OSGi settings for the Persisted Query Service Configuration. Managing Cache with an OSGi configuration ![]() Managing Cache with Cloud Manager variablesĬloud Manager Environment Variables can be defined with Cloud Manager to define the required values: Name See How to persist a GraphQL query, for an example of persisting a query using cURL. The cache-control is optional when creating the persisted query, as AEM can provide the default value. The cache-control can be set at the creation time (PUT) or later on (for example, via a POST request for instance). Update a persisted query by POSTing to an already existing query path.įor example, use the persisted query: $ curl -X POST \ You can then request the persisted query by GETing the URL /graphql/execute.json/.įor example, use the persisted query: $ curl -X GET \ "path": "/conf/wknd/settings/graphql/persistentQueries/plain-article-query" "shortPath": "/wknd/plain-article-query", H 'authorization: Basic YWRtaW46YWRtaW4=' \ Prepare the query by PUTing it to the new endpoint URL /graphql/persist.json//.įor example, create a persisted query: $ curl -X PUT \ To persist a given query using the cURL command line tool: Query document and variables, attaching body to. Using fetch for simple GET REST API request. The GraphiQL IDE is the preferred method for persisting queries. How to execute GraphQL queries and mutations using fetch API. GraphiQL IDE - see Saving Persisted Queries (preferred method).There are various methods of persisting queries, including: It is recommended to persist queries on an AEM author environment initially and then transfer the query to your production AEM publish environment, for use by applications. They just happen to use the same model - but via different endpoints. These are two different queries - saved under different paths. Specific Sites configuration(s) and endpoint(s)Ĭreating a persisted query for a specific Sites configuration requires a corresponding Sites-configuration-specific endpoint (to provide access to the related Content Fragment Models).įor example, to create a persisted query specifically for the WKND Sites configuration, a corresponding WKND-specific Sites configuration, and a WKND-specific endpoint must be created in advance.The query has access to all Content Fragment Models. Persisted queries must always use the endpoint related to the appropriate Sites configuration so they can use either, or both: For cases that need customization (for example, when customizing the cache) you can use the API see the cURL example provided in How to persist a GraphQL query. The GraphiQL IDE is available in AEM for you to develop, test, and persist your GraphQL queries, before transferring to your production environment. See GraphQL Query Best Practices (Dispatcher) for details, and the related Dispatcher configuration. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |