• 1Installation
  • 2Preliminary Knowledge
  • 3G.apex Demo
  • 4G.apex Query
  • 5Create Object Types
  • 6Create Schema
  • 7Resolver Functions
  • 8Serve Query Request
  • 9Mutation
  • 10Parameters
  • 11Default Value
  • 12Aliases
  • 13Fragments
  • 14Variables
  • 15Directives

G.apex

  • Docs
  • Tutorials
Getting started with G.apex

G.apex Query

G.apex uses a different query syntax from GraphQL. It uses JSON format like this:

{
    "query": {
        "book": {
            "@id": "2",
            "name": ""
        }
    }
}

This is somehow equivalent to the true GraphQL below:

{
    book(id: 2) {
        name
    }
}

This query will yield results like this:

{
    "query": {
        "book": {
            "name": "Second Book"
        }
    }
}

For those who are not familiar with GraphQL, the code above means that we want to query the book with id equals to 2, retrieving the name of the book.

We use JSON to define the query language primarily because we want to avoid unnecessary use of compute in Apex considering the governor limits.

Done