Queries
Queries do not require authentication of the client through the means of an access token, however the type of data returned may be filtered. For example if the "address" field requires a certain "user role" to view then if a querying user does not have that role null will be returned for that field.
For more information on how to utilize the graphQL query function graphl.org provides excellent tutorails.
Query that would return all available information of users without search criteria
For brevity ...all object fields available has been used to reduce repetivitiy.
profiles{
gcID,
name,
email,
avatar,
mobilePhone,
officePhone,
titleEn,
titleFr,
address{
id,
streetAddress,
city,
province,
postalCode,
country
},
team{
id,
nameEn,
nameFr,
descriptionEn,
descriptionFr,
organization{
id,
nameEn,
nameFr,
acronymEn,
acronymFr
},
owner{
..all profile object fields
}
},
members{
...all profile object fields
}
}
},
ownerOfTeams{
...all team object fields
}
},
outstandingApprovals{
id,
gcIDApprover{
...all profile object fields
},
gcIDsubmitter{
...all profile object fields
},
requestedChange{
id,
name,
email,
avatar,
mobilePhone,
officePhone,
address,
titleEn,
titleFr,
team{
...all team object fields
},
createdOn,
actionedOn,
deniedComment,
status,
changeType
}
}
}Query search criteria
Search criteria fields can be used separately or chained together to easily filter through data.
Auto-complete name profile search
Available Arguments
partialNamename contains - case insensitive (string)
Example:
query{
search(
partialName:"bry"
)
}Profile
Available Arguments:
gcIdexact match (string)namename contains - case sensitive (string)emailexact match (string)mobilePhonemobile number contains (string)officePhoneoffice number contains (string)titleEntitle contains (string)titleFrtitle contains (string)
Example with all available arguments:
query{
profiles(
gcID:"string",
name:"string",
email:"string",
mobilePhone:"string",
officePhone:"string",
titleEn:"string",
titleFr:"string"
)
}Addresses
Available arguments:
idexact match (int)streetAddressstreet address contains (string)citycity contains (string)provinceexact match (string)postalCodeexact match (string)countryexact match (string)
Example with all available arguments
query{
addresses(
id:2,
streetAddress:"string",
city:"string",
province:"string",
postalCode:"string",
country:"string"
)
}Teams
Available arguments:
idexact match (int)nameEnenglish name contains (string)nameFrfrench name contains (string)
Example with all available arguments:
query{
teams(
id:2,
nameEn:"string",
nameFr:"string",
)
}Organizations
Available arguments:
idexact match (int)nameEnname of organization contains (string)nameFrname of organization contains (string)acronymEnexact match (string)acronymFrexact match (string)
query{
organizations(
id:1,
nameEn:"string",
nameFr:"string",
acronymEn:"string",
acronymFr:"string"
)
}Approvals
Available Arguments:
idexact match (int)gcIDApproverexact match (gcID of profile object)gcIDSubmitterexact match (gcID of profile object)statusenum (enum ofPending,Approved,Denied)changeTypeenum (enum ofInformationalorMemebership)
Example using all available Arguments
query{
approvals(
id:6,
gcIDApprover:{
gcID:"12243"
},
gcIDSubmitter:{
gcID:"5431"
},
status: Pending
changeType: Informational
)
}Pagination
Retrieving too much data on a single request is not practical and may break your app. Pagination exists to solve this problem, allowing the client to specify how many items it wants.
The simple way defined in the GraphQL pagination documentation is to slice the results using two parameters: first, which returns the first n items and skip, which skips the first n items.
These two pagination parameters have been implemented on all of the search query functions.
The example query below will search for all profiles that contain the name "Bryan" but instead of returning the complete array the query below is requesting items 2 and 3 in the array. Skip the first item in the array and send the next 2 in the array.
query{
profiles(name:"Bryan", first:2, skip:1){
name,
avatar,
email
}
}