Testing your Service

Once you have defined a GraphQL API you can use the built-in tester to test your GraphQL API.
--- LINKS ---
Free Community Edition Download
Alpha Software YouTube Channel
#api #graphql #mobileapp #app #ui #android #ux #ios #mobileappdevelopment #appdesign #uidesign #mobileapps #appdevelopment


in the previous video we defined a new

growth QL service called growth KL 1 now

I'm going to show how you can test that

service using the built-in growth ql

tester that comes with alpha anywhere so

I'm gonna right click on the service

name over here and then say test with

growth IQ l so graph IQ L is the built

in tester and you can either test this

in live mode which means that the Alpha

anywhere development server must be

turned on or you can use working preview

which means that you can test it without

having to turn on the alpha server so

I'm going to test it using working

preview over here so this opens up the

growth IQ l tester and this tester has

various sacredness as so first of all on

the left hand side we have history which

contains all of the previous queries

that I've been testing so I can just

sort of close that down and then on the

right hand side we have the

documentation Explorer which shows us

all the different growth QL queries that

the service defines so here are all the

different queries that we can execute so

get category get many categories get

customer etc and then we can also look

at the mutations so mutations are

queries that modify the data so we can

add a category updating a degrees etc so

the the schema second hat shows us the

schema of the growth ql service so let's

go here and start out by doing a query

that returns data from the customer

table so we can go here and we can type

in query and then the actual query is

going to be get customer and then we can

basically go and specify what columns

from the customer table we'd like to

return but we can also specify which

particular customer we want to see so we

can go here and inside parentheses we're

going to type in customer ID which is

the the field that we're going to query

on and then I'm going to go

here and type in a semicolon and then

I'll type can say bollard so that's the

customer that we're gonna return and

then I'll go here now time can say

customer ID contact name company name

city and country we can then go and

click the prettify button to reformat

that and now we'll go ahead here and

execute the query and you can see now

that we are returning the data for the

customer called bollard and we're

returning these fields from that name

but as you recall from the previous

video when we defined the schema for the

service there was a children property

for the customer table so for each

customer we can get a list of the orders

so let's go here and type in say orders

and now from the orders table we can

specify what columns we won so I'll go

here and say order ID and then I'll

basically go here and say let's go here

and say order date etc so let's go there

now and execute this so here we can see

that for each customer we're getting a

list of the orders now let's say that

for each order we'd like to see what

their order details were so we'll go

here and we'll type in order details and

then for each order detail we can

specify we want the product ID and the

quantity so let's go ahead now and run

that so you can see now we're seeing the

customer then we're seeing the orders

and then for this order here are their

order details but as you may recall from

the previous video we defined the schema

for the service

there was a join in the order details

definition that specified that order

details was joined to

so that means that for each order detail

we can get the product description from

the products table so let's go here and

type in product name and then execute

that and so now you can see that we have

the product name but we have a property

name here that looks a little odd so

let's go here and give an alias to this

field here so I'll just go here and type

in product name colon and then execute

and we can see now that we've aliased

this field so we've made a single API

call to the endpoint right now but we've

returned data from the customer table

the orders table and also the order

details table but we can actually do

more so let's go here and give an alias

to this entire results I'll go there and

say q1 and then execute this so now

basically you can see that our result is

coming back in a property called q1 and

then I can take this entire query string

over here and duplicate it so let's go

there and duplicate it over there and

now change this from bollard to alpha

key and we'll call this now q2 so we'll

go ahead and execute this so he has q1

which is bollard and then if we scroll

down we see there's q2 which is alpha

key so now we've basically made again a

single call to our API endpoint but

we've returned two different query

results in a single API call returning

data for both bollard and elf key so so

far we've basically used an explicit

value for the customer ID here in the

next video we're going to talk about how

you can use variables in your query