The Aha! Develop GraphQL API provides you with a flexible way to find and update the information in your Aha! Develop account. You can also use the GraphQL API within your extensions to closely integrate them with your Aha! Develop data.
To learn how to use GraphQL in general, try a short introduction. To quickly get familiar with the Aha! Develop GraphQL API, try the GraphQL API Explorer, where you can immediately start running GraphQL queries and requests against your live account.
The GraphQL API Explorer also contains documentation on the entire API, including all endpoints and fields.
Click any of the following links to skip ahead:
Authentication
All API requests must be appropriately authenticated. If you are accessing the API through an extension, you can assume you are already authenticated as the user accessing that extension. If you are accessing the API outside of Aha! Develop, you must authenticate using an OAuth2 token.
OAuth2 token
Before using an OAuth2 token to authenticate an API call, the external application must be registered and the user must authorize the external application to access their account.
Once the user has authorized the application, the OAuth2 access token can be included in the header of the API request:
curl -H "Authorization: Bearer 1111111111" https://company.aha.io/api/v2/graphql
Use the aha object
Inside of an extension, you can easily make GraphQL requests and updates through the aha object:
const mutation = `
mutation {
createExtensionSetting(attributes: {
identifier: ${JSON.stringify([EXTENSION_ID, key].join("."))},
value: ${JSON.stringify(newValue)},
scope: ${JSON.stringify(scope)}
}) {
errors {
attributes {
name
messages
fullMessages
codes
}
}
}
}
`;
await aha.graphMutate(mutation);
You can use aha.graphQuery to send a GraphQL query and aha.graphMutate for a mutation. Each method will return a promise containing the result.
Use aha.models
The aha object provides a higher-level way of working with Aha! Develop data using aha.models:
const scope = aha.models.Feature.select('id', 'name').where({ projectId })
// Executes the query, returning a page of records:
const features = await scope.all();
// Update the first feature's name and save it
const feature = features[0];
feature.name = "A changed feature name";
const success = await feature.save();
Read about the model API documentation for more information on using aha.models.