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
  • Mutation Types
  • Schema Definition

Was this helpful?

  1. Endpoints
  2. Tenants

Tenant Mutation

Create or Update in EverReal

PreviousTenants QueryNextContract

Last updated 1 year ago

Was this helpful?

Mutation Types

Mutations are responsible to insert or update a specific register, the operation insert or update is defined by externalId, in case this tenant was imported previously, this mutation will updated the resource, otherwise will create the tenant. If you wish to update the externalId, pass EverReal UUID as id in the mutation payload along with the changed externalId

type Mutation {
    upsertTenant(tenant: TenantInput): Tenant
    deleteTenant(externalId: String): AsyncEventResponse
    removeTenant(id: String): Boolean
}

Here are details on the capabilities of different mutations

  • The upsertTenant mutation is used to create or update a tenant in Everreal system and tenant added to the system cannot be modified by Everreal and if needs to be modified it should be done via the same endpoint itself.

  • The deleteTenant mutation is used to delete the tenant relation with the external integration source, doing this will not delete the tenant but instead it will remain as a detached tenant from integration and can be modified using Everreal.

  • The removeTenant mutation is used to remove the tenant from the system, in order to perform removeTenant, please make sure that all the contracts assosiated with the tenant is been removed ( to delete contract)

Schema Definition

items with ! notation are required

input TenantInput {
  id:String #EverReal UUID typically can be passes in case of updating externalId
  externalTenantId: String! #externalTenantId by which the tenent is identified
  unitId: String! #unitId by which the tenent will be attached to. You have to either pass unitId or exteranalunitId 
  externalUnitId: String! #exteranalunitId by which the tenent will be attached to. You have to either pass unitId or exteranalunitId
  firstName: String!
  lastName: String!
  email: String
  companyName: String
  phoneNumber: String
  cellPhoneNumber: String
  additionalTenants: [AdditionalTenant]
  coldRent: String       # number format should be numeric "123456.34" 
  serviceCharges: String # number format should be numeric "123456.34"
  heatingCosts: String   # number format should be numeric "123456.34"
  totalRent: String      # number format should be numeric "123456.34"
  securityDeposit: String # number format should be numeric "123456.34"
  contractStartDate: String #date format should be "YYYY-MM-DD" or "DD.MM.YYYY"
  contractEndDate: String #date format should be "YYYY-MM-DD" or "DD.MM.YYYY"
  meta: MetaInformation!
}

input AdditionalTenant {
  externalId: String
  firstName: String
  lastName: String
  email: String
  phoneNumber: String
}

input MetaInformation {
  source: String!
}

type AsyncEventResponse {
  statusCode: Int
  message: String
}

Below we are providing a full example how to create or update a tenant, all this information is not required, only the ones that was using ! notation previously.

mutation {
  upsertTenant(
    tenant: {
      meta: { source: "INTEGRATION_SOURCE" }
      externalTenantId: "91001+006"
      externalUnitId: "11092+1101"
      firstName: "Ivana"
      lastName: "Maric"
      email: "ivanamaric@everreal.co"
      coldRent: "900.00"
      serviceCharges: "880.00"
      heatingCosts: "3.00"
      totalRent: "500"
      securityDeposit: "500"
      contractStartDate: "01.01.2020"
      contractEndDate: "01.01.2024" 
      companyName: "gmbh"
    }
  ) { id }
}
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer ....");
myHeaders.append("Content-Type", "application/json");

var graphql = JSON.stringify({
  query:
    '\r\n mutation {\r\n  upsertTenant(\r\n    tenant: {\r\n      meta: { source: "INTEGRATION_SOURCE" }\r\n      externalTenantId: "91001+0069330"\r\n      externalUnitId: "11092+1101122211s"\r\n      firstName: "Ivana"\r\n      lastName: "Maric"\r\n      email: "ivana@masssric.de"\r\n      coldRent: "900.00"\r\n      serviceCharges: "880.00"\r\n      heatingCosts: "3.00"\r\n      totalRent: "500"\r\n      securityDeposit: "500"\r\n      contractStartDate: "01.01.2020"\r\n      contractEndDate: "01.01.2024"\r\n      placeOfBirth: "thotta"\r\n      companyName: "Everreal Gmbh"\r\n    }\r\n  ) {\r\n    id\r\n  }\r\n}',
  variables: {},
});
var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: graphql,
  redirect: 'follow'
};

fetch("http://{subdomain}.everreal.co/api/reporting/graphql", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
reference