EverReal
  • Introduction
  • Authentication
    • API ClientID and ClientSecret
    • Authentication limitations
  • Rate limiting
  • Helpers
    • Errors
    • Pagination
    • Formatting
  • How to guide
    • EverReal Data Import Process
      • Connect an Integration
      • Import Mappers
      • Ideal CSV Structure
      • Debug Imports
      • FAQ
    • Data import via GraphQL
  • Endpoints
    • Account users / members
    • Owners
      • Owners Query
      • Owners Mutation
    • Property Groups
      • Property Groups Query
      • Property Group Mutation
    • Properties
      • Properties Query
      • Properties Mutation
    • Units
      • Units Query
      • Units Mutation
    • Listing
      • Listing Query
      • Listing Mutation
    • Candidates
      • Candidates Query
      • Candidate Mutation
    • Messages
    • Contact Activites
    • Tenants
      • Tenants Query
      • Tenant Mutation
    • Contract
      • Contract Query
      • Contract Mutation
    • Contacts
      • Contact Mutation
      • Contact Query
    • Document management
      • Document management
      • Simple file upload
    • Tasks
      • Tasks Query
    • Protocols
      • Protocol Query
  • Webhooks
    • Owner Events
      • OWNER_CREATED
      • OWNER_UPDATED
      • OWNER_DELETED
    • Property Events
      • PROPERTY_CREATED
      • PROPERTY_UPDATED
      • PROPERTY_DELETED
    • Unit Events
      • UNIT_CREATED
      • UNIT_UPDATED
      • UNIT_DELETED
    • Listing Events
      • LISTING_ACTIVATED
      • LISTING_ARCHIVED
      • LISTING_UPDATED
      • LISTING_DEACTIVATED
      • LISTING_CREATED
      • LISTING_PUBLISHED_TO_CHANNEL
      • LISTING_UNPUBLISHED_FROM_CHANNEL
    • Candidates Events
      • CANDIDATE_PARSED
      • LISTING_CANDIDATE_APPLIED
    • Listing Contracting Events
      • LISTING_CONTRACT_FLOW_SIGNED
      • LISTING_CONTRACT_FLOW_PARTIALLY_SIGNED
      • LISTING_CONTRACT_FLOW_WITHDRAWN
      • LISTING_CONTRACT_FLOW_STARTED
    • Listing Scheduling Events
      • LISTING_CANDIDATE_SCHEDULE_TIMESLOT_BOOKING_REMOVED_CANDIDATE
      • LISTING_CANDIDATE_SCHEDULE_TIMESLOT_BOOKING_REMOVED_ADMIN
      • LISTING_CANDIDATE_SCHEDULE_TIMESLOT_BOOKED_CANDIDATE
      • LISTING_CANDIDATE_SCHEDULE_TIMESLOT_BOOKED_ADMIN
      • LISTING_CANDIDATE_SCHEDULE_NEW_TIMESLOTS_REQUESTED
      • LISTING_CANDIDATE_SCHEDULE_INVITED_VIEWING
    • Protocol Events
      • PROTOCOL_COMPLETED
  • Change log
    • Releases
      • Introducing Mappers
      • Enhancements for GraphQL
      • Enhancements for Querying
      • Enhancements for Webhooks
    • Upcoming
      • Introduced Querying Protocol in GraphQL
Powered by GitBook
On this page
  • Protocol query
  • Filter options
  • Protocol Query
  • Schema
  • Example

Was this helpful?

  1. Endpoints
  2. Protocols

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 id

  • draftId - filter by the protocol draft id

  • companyId - filter by company id

  • unitId - filter by the unit id

  • propertyId - filter by the property id

  • protocolType - 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
  }
});
PreviousProtocolsNextWebhooks

Last updated 4 days ago

Was this helpful?