Skip to main content

Examples

Queries and mutations examples


Important

Before running most queries or mutations, you need to be registered and have access to the XRAY platform. This way you will be allowed to get access to the authorization token.

Query Example

Query country request

query country($queryParams: PageRequestInput) {
countries(pageRequestInput: $queryParams) {
data {
...SelectAllFields
__typename
}
totalCount
__typename
}
}

fragment SelectAllFields on Country {
id
name
isoCode2
isoCode3
order
deleted
__typename
}

Query country response

{
"data": {
"countries": {
"data": [
{
"id": "0859d93f-6530-480d-8169-4b122b38fe62",
"name": "Bosnia",
"isoCode2": "BA",
"isoCode3": "BIH",
"order": 100,
"deleted": null,
"__typename": "Country"
}
],
"totalCount": 1,
"__typename": "PaginatorCountryGType"
}
}
}

Query session request

query sessions($pageRequestInput: PageRequestInput!) {
sessions(pageRequestInput: $pageRequestInput) {
totalCount
data {
apiTokenId
description
errorCode
}
data {
id
code
description
isTesting
webHook
created
modified
deleted
status
overallCheckStatus
persons {
id
firstName
lastName
}
businesses {
id
companyName
}
checks {
id
started
checkStatus
results {
id
category
}
}
}
}
}

Query session response

{
"data": {
"sessions": {
"totalCount": 2,
"data": [
{
"apiTokenId": null,
"description": "123",
"errorCode": null,
"id": "4a9c55b0-510d-49e8-911c-f7c0e96a8cd7",
"code": "123",
"isTesting": true,
"webHook": null,
"created": "2022-04-19T10:56:32.253Z",
"modified": "2022-04-19T10:56:32.818Z",
"deleted": null,
"status": "DONE",
"overallCheckStatus": "PASSED",
"persons": [],
"businesses": [
{
"id": "5902f542-0fee-49c8-840e-db20c5abcdcd",
"companyName": "123"
}
],
"checks": [
{
"id": "ac21dd5d-8beb-478f-a560-7d5f2a83198b",
"started": null,
"checkStatus": "PASSED",
"results": []
}
]
},
{
"apiTokenId": null,
"description": "Test",
"errorCode": null,
"id": "fda9c69c-c877-4182-912f-4bfbaaa6b965",
"code": "1",
"isTesting": true,
"webHook": null,
"created": "2022-04-18T14:38:33.462Z",
"modified": "2022-04-18T14:38:34.103Z",
"deleted": null,
"status": "DONE",
"overallCheckStatus": "PASSED",
"persons": [],
"businesses": [
{
"id": "c5bf6276-1ad0-4843-93f0-8645748e9b9e",
"companyName": "Barry Ln"
}
],
"checks": [
{
"id": "a2873a3e-2d55-49af-981b-a160d1dbbbdd",
"started": null,
"checkStatus": "PASSED",
"results": []
}
]
}
]
}
}
}

Mutations Example

Mutation getToken example

mutation getToken {
getToken
}

Mutation getToken response

{
"data": {
"getToken": "eyJhcGciOiJIUzI1NiIsInR5cCI6IkpXVCJ11.eyJzdWIiOiJBUEk6IFRlc3QiLCJqdGkiOiJkNjc2NWI4Yy0xMDQ5LTRiYjYtYTA0Mi1jNWJjODc0NjdjZmMiLCJjb21wSWQiOiIyMmE5ZjE2Zi03YWVhLTRhM2MtYmE2NC00MDNkZjllYTdmY2IiLCJ0b2tlbklkIjoiZDY3NjViOGMtMTA0OS00YmI2LWEwNDItYzViYzg3NDY3Y2ZjIiwiaXAiOiI6OmZmZmY6MTI3LjAuMC42IiwicGVybWlzc2lvbiI6WyI3MCIsIjcxIiwiNzIiLCI2MCJdLCJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvY2xhaW1zL3JvbGUiOiJTZXJ2aWNlIiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbmFtZSI6IjIyYTlmMTZmLTdhZWEtNGEzYy1iYTY0LTQwM2RmOWVhN2ZjYiIsImV4cCI6MTY1ODkxNjQ2NCwiaXNzIjoiaHR0cDovL3hyYXktZGV2LmludmVuaXQuaW8iLCJhdWQiOiJodHRwOi8veHJheS1kZXYuaW52ZW5pdC5pbyJ9.HnLU0Ssaf-D6Tz1EXchGIM-Yv5R_gwU4nGFsDUOWt0001"
}
}

Read more