GraphQL GlideRecord_Query - Learn Integrations on the Now Platform
[Music] in this video we'll use the graphql Explorer we saw in the previous video to run a few queries against a built-in Glide record API to make it easy for third-party apps to interact with the platform's table structure the Glide record graphql API is similar to the table apis available for rest requests as well for this video and the remainder of this series that use the the graphql Explorer we'll be using a use case for a fictional company called Misty Mountain Adventures Misty Mountain Adventures is an outdoor Excursion team that takes their clients on unique travels through unknown lands they've put in place a workflow to track their cases customers face on their expeditions now they need a graphql API so their workspace components service portal widgets and thirdparty systems can access and modify data from the records while this could be done using rest apis Misty Mount is specifically requested graphql because of the efficiency of returning smaller payloads you see payload size is important in every aspect of their business because some of their customers are shall we say of smaller stature here's a list of cases they have in their system these records are pretty straightforward with the number customer short description and so on the Glide record query has a similar structure to the the sample shown in the first video with some features that bear noting let's take a look we start with a pair of curly braces like usual and the optional keyword query or mutation inside we use the word Glide recore query within that is the table name we want to query in this case X under snc under mm under case we then use the underscore results section to indicate which fields we want to fetch let's start with the number and short description if we try to run this query we get this common error note the part about the sub selection requires that means that the query requires more detail on the number field we need to add one more level and indicate if we want the value display value or both since it's a string field we can just use the value however consider your options carefully for things like Choice fields and reference field as the value and display value often return different results we'll do the same for short description you might also note that we don't have color-coded keywords because introspection on the Glide record query here is turned off to turn it on we would need to set the system property shown here to true however if we did that the system would take a couple of extra minutes to start the graphql Explorer so we're leaving it set false for now if you're the type to start your graphql Explorer in the morning and use it all day without a refresh then you may want to consider turning it on while number and short description are simple string Fields let's take a look at how we can retrieve values from a reference field effectively dot walking into a graphql query we'll first specify the field name then use curly braces for the details beginning with the underscore reference block within there we'll reference the fields from the customer table the same way as the parent table with fields and values or display value note that display value is camel case here not underscore as in some other cases and when we execute this query we can see from the Json response payload that the customer data is inside the underscore reference object let's do one more thing let's say we don't want all records but just the active P1 cases we can use parentheses after the table name and put a query condition keyword and the encoded query string like this this this is just one of the parameters defined in the schema but it gives you an idea of how you can interact with filters sorting and more that's the basics of the Glide record query API and how you can read records from the table but what if you need a custom API to have full control over the inputs the processing and response payload well I invite you to join me in the next few videos where we'll build one of our own for Misty Mountain Adventures come on along
https://www.youtube.com/watch?v=KzhRUB-FzEs