Category: Data Source
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

GitHub’s API as an authenticated API DataSource

Issue

I'm trying to build a page to list/delete/inspect GitHub installations but Octokit isn't supported. I'm looking for a good template or example of how to do it. I've tried creating an authenticated API and using curl, but the installation token URL varies per installation. Can anyone help me out with a solution?

Resolution

The solution to easily list, delete, and inspect GitHub installations is to use Appsmith's GraphQL plugin with GitHub GraphQL. GitHub GraphQL API allows you to manage installations, repositories, and users programmatically. Appsmith's GraphQL plugin provides a visual interface to compose and execute GraphQL queries.

To get started, first, authenticate your app with GitHub App. Then, use the GraphQL plugin to compose queries to get the required information about installations. For example, the following query gets a list of installations:

query GetInstallations {
viewer {
login
installations(first: 100) {
nodes {
id
account {
login
}
}
}
}
}

You can also use mutation queries to delete installations. Here's an example:

mutation UninstallApp($installationId: ID!) {
deleteInstallation(input: { clientMutationId: "1", installationId: $installationId }) {
clientMutationId
}
}

You can pass the installation ID as a parameter when executing the query to delete the installation.

In summary, by leveraging Appsmith's GraphQL plugin with GitHub GraphQL API, you can easily manage GitHub installations. You can use GraphQL queries to get the needed information and mutation queries to delete installations.