Getting Started

Glue's public API is built using GraphQL and follows the Relay specification. It's the same API we use internally for developing our applications. If you are new to GraphQL, Apollo has resources for beginners. The official GraphQL documentation is another good starting point.

Endpoint

Glue's GraphQL endpoint is:

https://api.gluegroups.com/public/graphql

It supports introspection so you can query the whole schema.

Authentication

The Glue API supports OAuth2 authentication.

OAuth

OAuth2 authentication is required. Once you complete the authentication flow and acquire an access token, pass it with the header Authorization: Bearer <ACCESS_TOKEN>

curl \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  --data '{ "query": "{ groups { nodes { id name } } }" }' \
  https://api.gluegroups.com/public/graphql

Glue IDs

Glue uses prefixed IDs to identify different types of resources. The prefix indicates the resource type, followed by a unique identifier. Common prefixes include:

  • usr_ - Users

  • thr_ - Threads

  • grp_ - Groups

  • wks_ - Workspaces

  • msg_ - Messages

For example: usr_2a1b3c4d5e6f7g8h9i0j, thr_1b2c3d4e5f6g7h8i9j0k, grp_3c4d5e6f7g8h9i0j1k2l

These IDs can be used in GraphQL queries and mutations, and they work with the Relay node query to fetch any type of resource.

Glue SDK

The Glue SDK exposes the Glue GraphQL schema, and makes it easy to access models, or perform mutations. We recommend using it to interact with the GraphQL API. It is written in TypeScript, allowing all operations to be strongly typed.

Getting Started

We recommend using a GraphQL client to introspect and explore the schema if you are not using the Glue Client (SDK).

Our GraphQL API is explorable and queryable via Apollo Studio, no download or log in required. Click the Schema tab to browse the schema, and click the Explorer tab to run queries.

Once you have your client installed, you can start making queries (read) and mutations (write) to the API.

Queries & Mutations

To get information about the authenticated user, you can use the me query:

query Me {
  me {
    id
    name
  }
}

You can use the groups query to get a list of groups.

query Groups {
  groups {
    nodes {
      id
      name
    }
    totalCount
  }
}

If you have a specific group ID, you can use a node query to query for the group.

query Group {
  node(id: "grp_2a1b3c4d5e6f7g8h9i0j") {
    ... on Group {
      id
      name
    }
  }
}

The node query is part of the Relay specification. It can be used to query any object by its ID, and the response is polymorphic. The response type is tied directly to the type of ID passed in and you need to use fragments to specify which type you're querying.

Here's a similar example where we query for a thread:

query Thread {
  node(id: "thr_1b2c3d4e5f6g7h8i9j0k") {
    ... on Thread {
      id
      subject
    }
  }
}

And here's an example of querying a thread edge. The thread edge contains user specific information for the given thread ID.

query ThreadEdge {
  node(id: "thr_1b2c3d4e5f6g7h8i9j0k-usr_2a1b3c4d5e6f7g8h9i0j") {
    ... on ThreadEdge {
      id
      cursor
      recipientRole
      subscription
      node {
        id
        subject
        createdAt
      }
    }
  }
}

This query returns the user's recipientRole and subscription with respect to the thread, as well as the thread subject and creation date.

To learn more, take a look at these other pages:

Sending Messages

Understanding Glue Thread Types

Pagination

To see everything that is available, check out our GraphQL Explorer. This serves as a complete API reference and also provides an interface to help you construct and run queries.

Support

If you run into problems or have questions or suggestions, you can reach us in Glue using the "Contact Support" option under the Help menu in the top right corner or send us a note ([email protected]).

Last updated

Was this helpful?