Protocol Query
This query will allow you to pull protocols from EverReal.
Protocol query
The protocol graphQL query allows one to retrieve protocols information from EverReal.
Filter options
id
- filter by the protocol iddraftId
- filter by the protocol draft idcompanyId
- filter by company idunitId
- filter by the unit idpropertyId
- filter by the property idprotocolType
- filter by the protocol type. See possible options in types below.
Protocol Query
To query a protocol from EverReal use protocol
query
type Query {
protocols(input: ProtocolFilterListPaging): [Protocol]
}
Schema
enum ProtocolType {
MOVE_IN
MOVE_OUT
SELLING
PRE_MOVE_OUT
}
enum ProtocolVersion {
V1
V2
}
type Protocol {
id: ID!
protocolVersion: ProtocolVersion
companyId: String!
propertyId: String
unitId: String
documentId: String
additionalNotes: String
moveInExtraInformation: MoveInExtraInformation
moveOutExtraInformation: MoveOutExtraInformation
sellingExtraInformation: SellingExtraInformation
uploadsRootId: String
draftId: String
protocolType: ProtocolType!
createdAt: DateTime!
updatedAt: DateTime!
deletedAt: DateTime
property: Property
unit: Unit
company: Company
rooms: [ProtocolRoom!]!
meters: [ProtocolMeter!]!
keysets: [ProtocolKeyset!]!
persons: [ProtocolPerson!]!
savingProgress: ProtocolSavingProgress
signatureAcknowledgementText: String
}
type ProtocolRoom {
id: ID!
protocolId: String!
name: String!
floorType: ProtocolRoomFloorType
wallType: ProtocolRoomWallType
ceilingType: ProtocolRoomCeilingType
smokeDetectors: Int
additionalNotes: String
hasPreinstalledFurniture: ProtocolRoomFurniture
roomInGoodCondition: Boolean
isInspected: Boolean
createdAt: DateTime!
updatedAt: DateTime!
}
type ProtocolMeter {
id: ID!
protocolId: String!
unitMeterId: String
stand: String
type: ProtocolMeterType!
number: String!
pictures: [File!]
createdAt: DateTime!
updatedAt: DateTime!
deletedAt: DateTime
}
type ProtocolKeyset {
id: ID!
protocolId: String!
unitKeysetId: String
quantity: Int!
type: ProtocolKeysetType
model: String
pictures: [File!]
keyNumbers: [ProtocolKeyNumber!]
createdAt: DateTime!
updatedAt: DateTime!
deletedAt: DateTime
}
type ProtocolPerson {
id: ID!
protocolId: String!
companyContactId: String
email: String
firstName: String
lastName: String
phoneNumber: String
role: ProtocolPersonType
signature: ProtocolPersonSignature
createdAt: DateTime!
updatedAt: DateTime!
}
type ProtocolFilterListPaging {
filter: ProtocolFilter
paging: GraphPaging
sort: GraphSorting
}
type ProtocolFilter {
id: String
draftId: String
companyId: String
propertyId: String
unitId: String
protocolType: ProtocolType
}
type GraphPaging {
skip: Int
take: Int
}
type GraphSorting {
fieldName: String
direction: String
}
Example
query GetProtocols {
protocols(input:
{
filter:{
id:"b953017a-3824-4b44-a28f-e872a3c53b09"
unitId:"b953017a-3824-4b44-a28f-e872a3c53b08",
propertyId:"b953017a-3823-4b44-a28f-e872a3c53b09",
draftId:"b953017a-3824-4b44-a28f-e872a4c53b09",
companyId:"341de250-2fd6-11e7-9e51-ff0020488d44",
protocolType:"V2"
}
}
){
id
draftId
propertyId
companyId
unitId
protocolType
protocolVersion
unit {
id
}
company {
id
}
property {
id
}
keysets {
id
pictures {
id
}
}
meters {
id
protocolId
unitMeterId
stand
number
pictures{id}
}
rooms {
id
}
}
}
async function fetchProtocols() {
const graphqlEndpoint = 'https://acme-qa.everreal.co/api/reporting/graphql'; // Replace with your actual GraphQL endpoint URL
const query = `
query GetProtocols($filterInput: ProtocolFilter!) {
protocols(input: { filter: $filterInput }) {
id
draftId
propertyId
companyId
unitId
protocolType
protocolVersion
unit { id }
company { id }
property { id }
keysets {
id
pictures { id }
}
meters {
id
protocolId
unitMeterId
stand
number
pictures { id }
}
rooms { id }
}
}
`;
const variables = {
filterInput: {
id: "b953017a-3824-4b44-a28f-e872a3c53b09",
unitId: "b953017a-3824-4b44-a28f-e872a3c53b08",
propertyId: "b953017a-3823-4b44-a28f-e872a3c53b09",
draftId: "b953017a-3824-4b44-a28f-e872a4c53b09",
companyId: "341de250-2fd6-11e7-9e51-ff0020488d44",
protocolType: "V2"
}
};
try {
const response = await fetch(graphqlEndpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
// Add any necessary Authorization headers here e.g.,
// 'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
body: JSON.stringify({
query: query,
variables: variables // Send variables separately
})
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const result = await response.json();
if (result.errors) {
console.error("GraphQL Errors:", result.errors);
// Handle GraphQL errors (e.g., validation errors, execution errors)
} else {
console.log("Protocols Data:", result.data.protocols);
// Process the received data (result.data.protocols)
return result.data.protocols;
}
} catch (error) {
console.error("Error fetching protocols:", error);
// Handle network errors or other exceptions
}
}
// Example usage:
fetchProtocols().then(protocols => {
if (protocols) {
console.log("Successfully fetched protocols.");
// Do something with the protocols array
}
});
Last updated
Was this helpful?