Skip to content

Latest commit

 

History

History
29 lines (17 loc) · 2.39 KB

File metadata and controls

29 lines (17 loc) · 2.39 KB

CarbonLake - API

The CarbonLake API provides programmatic access to the decarbonization measurement data that is generated by the CarbonLake calculation process. The CarbonLake API is built using GraphQL on AWS AppSync.

Usage

After you deploy the CarbonLake API stack, the GraphQL endpoint URL can be found in the graphqlUrl CloudFormation output. You can use this URL to access the CarbonLake API (Note: Authentication is required by default. Please see the Authentication section for more details). This can be done with any GraphQL client. If you don't have a GraphQL client, you can use the client baked into the AWS AppSync console.

AWS AppSync Console GraphQL Client

The AWS AppSync GraphQL client is an easy way to exercise an AWS AppSync GraphQL endpoint. It is also a great way to see sample queries that can be performed. Use the steps below to interact with the CarbonLake API.

  1. Navigate to AWS AppSync in the AWS console
  2. Select the API for the CarbonLake stack you have deployed
  3. In the left-hand pane, select Queries
  4. Use the visual query editor to build out the GraphQL query you would like and hit the play button
    • Note: Authentication is required by default. Please see the Authentication section for more details

Authentication

By default, the CarbonLake API requires authentication to execute any call to the API. This is provided by Amazon Cognito. This quickstart deploys a default Cognito User Pool, Cognito Identity Pool, and admin user. During the deployment of the CarbonLake quickstart, you had to provide an admin email. This is used by Cognito to send the initial password for the default admin user. When you first login with this admin user you will be forced to change the password (an easy way to change this password is through the AWS AppSync Console GraphQL Client). From this point on, you must use this admin email and new password to authenticate to the CarbonLake API.

Additional Users

If you would like to add additional users, this can be done by adding users to the default deployed Cognito User Pool.

Schema

The schema used for GraphQL can be found in the schema.graphql file.