Skip to content

Instantly share code, notes, and snippets.

@alvintamie
Last active March 1, 2024 05:40
Show Gist options
  • Save alvintamie/3de859099406b95dcc3ad4b0c6a87dd5 to your computer and use it in GitHub Desktop.
Save alvintamie/3de859099406b95dcc3ad4b0c6a87dd5 to your computer and use it in GitHub Desktop.
Rest Contract
{
"query”: {
“Account”: {
"arguments": {
"first": 5,
"after": "<x0>", // cursor next
"where": {
{
"AccountId": {
"inq": { // perform join AccountId where account id match following
"Case": {
"and": [
{ Name: { like: "United%" } },
{ Industry: { eq: "Energy" } }
]},
"ApiName": "Id" // seems to mark left join accountId with id. Change to on?
}
},
"or": [ // this statement or equivalent (Probability=100 AND StageName='Closed Won') OR (Type='New Customer' AND ExpectedRevenue>1000000)
{
Probability: { eq: 100 },
StageName: { eq: "Closed Won" }
},
{
Type: { eq: "New Customer" },
ExpectedRevenue: { gt: 1000000 }
}
] /
}
}
},
"orderBy": { Industry: { order: ASC }, Id: { order: ASC },
"upperBound": 1000,
},
"edges": {
"node": [
// for system defaults no need to ask, always returned
// "Id", // system defaults
// "DisplayValue", // system defaults
// "LastUpdatedAt", // system defaults
// "CreatedAt", // system defaults
// "RecordTypeId" // system defaults
"Name", // dynamic fields
"CompanyName", // dynamic fields
"Author": [// this is parent relationship aka 1:1, notice theres no edges/node
// Id system default return
"Name"
],
"Cases": { // children relationship aka 1:many, you can modify with args and have edges/nodes
"arguments": {
"where": {
"CreatedBy": {
"FirstName": {
"eq": "Marc"
}
}
}
}
"edges": {
"node": [
"Name",
"Industry",
"Subject",
"Priority",
"CreatedBy": [ // parent relationship
"Name"
]
]
}
}
],
"cursor"
},
"totalCount",
"pageInfo": [
"pageResultCount",
"hasNextPage",
"startCursor",
"endCursor"
]
}
},
"entityInfos": {
entityNames: ["Account"],
"entityName",
"childRelationships": [
"fieldName",
"childEntityName",
...
],
"deletable",
"sortable",
---
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment