Getting Started
The Glue API is in beta. As the product evolves, we need to evolve the API as well. While we take breaking changes and deprecations seriously, the API is still in beta and we will need to make some of these changes.
For substantial breaking changes we will make an effort to reach out ahead of time in order to give you a chance to make the necessary changes to avoid disruption. While we're in beta, the notice period may be as short as a few weeks.
Glue's GraphQL API doesn't have versioning like many REST APIs. Instead the schema will evolve with certain things being marked with the @deprecated directive. This is usually accompanied by an addition to the schema intended to replace the deprecated functionality. Anything marked with @deprecated will be removed after some time.
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/graphqlIt 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/graphqlGlue 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_- Usersthr_- Threadsgrp_- Groupswks_- Workspacesmsg_- 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
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:
Understanding Glue Thread Types
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?
