Contracting
To use EverReal playground is required to provide the Bearer token, read more in Master Data page
To understand what is necessary and how to use graphql, in Master Data page we explain what is necessary to do
type Query {
contracts(input: ContractsFilterListPaging): [Contract]
}
type ContractTerms {
rent: Float
deposit: Float
heatingCosts: Float
utilityCosts: Float
totalMonthlyRent: Float
contractEndDate: Date
contractStartDate: Date
}
type ContractData {
terms: ContractTerms
}
type Contract {
id: String
startDate: Date
endDate: Date
status: String
unit: Unit
candidate: Candidate
tenants: [String]
versions: [JSON]
contractData: ContractData
contractDataString: String
createdAt: DateTime
updatedAt: DateTime
}
input ContractsFilter {
from: Date
to: Date
companyId: String
propertyGroupId: String
propertyId: String
ownerId: String
external: Boolean
status: String
}
input ContractsFilterListPaging {
filter: ContractsFilter
paging: GraphPaging
sort: GraphSorting
}
GraphQL
Javascript
CURL
query contracts($companyId: String, $propertyId: String, $status: String) {
contracts(
input: {
paging: { take: 100, skip: 0 }
filter: { companyId: $companyId, propertyId: $propertyId, status: $status }
}
) {
id
contractDataString
startDate
endDate
status
unit {
id
}
candidate {
id
}
versions
contractData {
terms {
rent
deposit
heatingCosts
utilityCosts
totalMonthlyRent
}
}
contractDataString
createdAt
}
}
Should look something like this.
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI1Y2MyYjViYy05ODgxLTQyNTEtODcxNy0wZTg5NDlmNThjZTkiLCJzdWIiOiI0MTQ2OWVjMS0yMjkzLTRjMjMtYWVmNy1lZjA4YzBkZTU0ZjEiLCJleHAiOjE2NTY1MDYxMjIsImlhdCI6MTY1NjUwMjUyMn0.V8kvTMvixCnf3447KEW34dSKzGi11_wzLZv8nvEPEnwV1Ahnxjwk6bDHEUs1lvl7Rx1or6jky-TwlnM06Ztnlh_bDUXS0YwnpxKWI2kxX9okYDIaggXYaEGK_j0M-1-VALX8HOifT2GftrjY_VN4_iNYyHRYqrtLTKteJASf48vqCu-01C_6j4LdD6ZW-pxUVsLMZz8efWBQCWODhDaXKd443YM8Hws5MRSEOGrv3JxH9-sV1DNZFMCKxuHyqt_RaYDA-jR4xZVzALdEQfTVllJIDsJiM9-OvXGXTceqTr5tSlu2JNITHsGh_MX4253Wds-Z8G1oHrLvfI-SBiLOsg");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "accept-language=en-US");
var graphql = JSON.stringify({
query: " query contracts($companyId: String, $propertyId: String, $status: String) {\n contracts(\n input: {\n paging: { take: 100, skip: 0 }\n filter: { companyId: $companyId, propertyId: $propertyId, status: $status }\n }\n ) {\n id\n contractDataString\n startDate\n endDate\n status\n unit {\n id\n }\n candidate {\n id\n }\n versions\n contractData {\n terms {\n rent\n deposit\n heatingCosts\n utilityCosts\n totalMonthlyRent\n }\n }\n contractDataString\n createdAt\n }\n }",
variables: {"status":"CONTRACT_TERMINATED"}
})
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: graphql,
redirect: 'follow'
};
fetch("https://acme.everreal.co/api/reporting/graphql", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));// Some code
curl --location --request POST 'https://acme.everreal.co/api/reporting/graphql' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI1Y2MyYjViYy05ODgxLTQyNTEtODcxNy0wZTg5NDlmNThjZTkiLCJzdWIiOiI0MTQ2OWVjMS0yMjkzLTRjMjMtYWVmNy1lZjA4YzBkZTU0ZjEiLCJleHAiOjE2NTY1MDYxMjIsImlhdCI6MTY1NjUwMjUyMn0.V8kvTMvixCnf3447KEW34dSKzGi11_wzLZv8nvEPEnwV1Ahnxjwk6bDHEUs1lvl7Rx1or6jky-TwlnM06Ztnlh_bDUXS0YwnpxKWI2kxX9okYDIaggXYaEGK_j0M-1-VALX8HOifT2GftrjY_VN4_iNYyHRYqrtLTKteJASf48vqCu-01C_6j4LdD6ZW-pxUVsLMZz8efWBQCWODhDaXKd443YM8Hws5MRSEOGrv3JxH9-sV1DNZFMCKxuHyqt_RaYDA-jR4xZVzALdEQfTVllJIDsJiM9-OvXGXTceqTr5tSlu2JNITHsGh_MX4253Wds-Z8G1oHrLvfI-SBiLOsg' \
--header 'Content-Type: application/json' \
--header 'Cookie: accept-language=en-US' \
--data-raw '{"query":" query contracts($companyId: String, $propertyId: String, $status: String) {\n contracts(\n input: {\n paging: { take: 100, skip: 0 }\n filter: { companyId: $companyId, propertyId: $propertyId, status: $status }\n }\n ) {\n id\n contractDataString\n startDate\n endDate\n status\n unit {\n id\n }\n candidate {\n id\n }\n versions\n contractData {\n terms {\n rent\n deposit\n heatingCosts\n utilityCosts\n totalMonthlyRent\n }\n }\n contractDataString\n createdAt\n }\n }","variables":{"status":"CONTRACT_TERMINATED"}}'
Copy link