Skip to main content

Develop with GraphQL

GraphQL is a query language for APIs. A REST API has a separate endpoint for each resource, so you often make several calls to collect related data. A GraphQL API has one endpoint, and you request exactly the fields you need in a single query.

Your GraphQL endpoint is https://tenant-name.is.here.io/here/api/graphql

For example, a REST API might need three calls:

GET /users/123
GET /users/123/posts
GET /posts/456/comments

A GraphQL API needs one query:

query {
user(id: "123") {
name
email
posts {
title
comments {
text
author
}
}
}
}
info

This example is generic. It doesn't reflect HERE APIs.

Schema​

The schema defines the queries, mutations, and types that an API supports. Use introspection to read the HERE schema.

Introspection​

Introspection queries ask the API to describe itself: its types, fields, queries, and mutations. Introspection fields begin with two underscores:

  • __schema returns the whole schema.
  • __type(name: String!) returns one type.
  • __typename returns the name of the current object's type.

List every type:

query {
__schema {
types {
name
kind
description
}
}
}

List the fields of one type:

query {
__type(name: "User") {
name
kind
fields {
name
type {
name
kind
}
description
}
}
}

List every query and its arguments:

query {
__schema {
queryType {
name
fields {
name
args {
name
type {
name
}
}
}
}
mutationType {
name
}
subscriptionType {
name
}
}
}

HERE GraphQL APIs​