In the previous multi-step GraphQL tutorial, you defined, and used, basic persisted queries to get Content Fragments data. Filter a list of Content Fragments using query variables This will scope all queries to models created in the WKND Shared project. Changing the Endpoint dropdown value here displays the existing Persisted Queries in the top-left corner. In the top-right corner, make sure that the Endpoint is set to WKND Shared Endpoint. In, some versions of AEM (6.X.X) the GraphiQL Explorer (aka GraphiQL IDE) tool needs to be manually installed, follow instruction from here. Next, explore the power of AEM’s GraphQL API using the built-in GraphiQL Explorer.įrom the AEM Start screen, navigate to Tools > General > GraphQL Query Editor. The GraphiQL tool also enables users to persist or save queries to be used by client applications in a production setting. The GraphiQL Explorer tool enables developers to create, and test queries against content on the current AEM environment. Query for inline content and fragment references from a multi-line text field.Filter for content within a fragment reference.Filter a list of Content Fragments with references using query variables.Please ensure that the previous chapters have been completed before proceeding with this chapter. This document is part of a multi-part tutorial. In this chapter, you use the GraphiQL Explorer to define more advanced queries to gather data of the Content Fragments that you created in the previous chapter. In the basic tutorial multi-step GraphQL tutorial, you used the GraphiQL Explorer to test and refine the GraphQL queries. Our board has 4 columns: one per "status.The GraphQL API in AEM allows you to expose Content Fragment data to downstream applications. To recap, we're pulling in JIRA issues to a Kanban board. When to Use Fragmentsīack to our JIRA example, I demonstrated precisely the sort of thing one should never do: making more than one GraphQL request to serve a single purpose. We've already seen how we can pass variables through our queries to receive contextual data: the next step is creating blocks of reusable code which may never change, which become the foundational building blocks of all future queries. This is where GraphQL Fragments come in to play. There's a core query being reused at the heart of our requests: we need to be dynamic enough to account for the fact that User 1 has checked off 13 different cuisines and strict delivery time windows, whereas User 2 doesn't give a shit. Yet, the information we're serving will always be restaurants. Aside from the obvious facts (residing in different locales), perhaps there's more metadata we can leverage from User 1's long-term app usage, versus User 2 who is a total noob to our knockoff app. Because we want our app to be intelligent, this means that circumstances in which User 1 makes a query are vastly different than User 2. Say we're building a GrubHub knockoff (we hate profits and love entering impenetrable parts of the market, it's not that uncommon really.) At its core, the information we're serving will always be restaurants we'll always want to return things like the restaurant address, name, rating, etc. Imagine a user cruising through your application, setting preferences, and arriving at core pieces of functionality under a content which is specific only to them. When building real applications consuming data via GraphQL, we usually don't know precisely the query we're going to want to run at run time. Last week we encountered a genuine scenario when working with GraphQL clients. Working With GraphQL Fragments and Mutations.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |