Getting started with Apollo Studio
You can sign up for Studio with either your GitHub identity or a username and password.
-
Go to studio.apollographql.com and click Let's get started.
-
Complete the signup flow, which includes:
-
Creating an organization that you can invite teammates to
-
Selecting a plan for your organization (the Free plan is always free, and the Team plan provides a free trial of paid features)
Note: The Apollo Docs suggest you import/link an existing schema. We have found that using the explorer to dynamically access this information is the easiest way to get started.
- Click the Apollo Explorer Button on the top left of the screen.
- On the top right of the screen is a sandbox url input, click the settings icon in this input.
- Enter in the Cloudfront GraphQL API URL and click
save
- Click the headers tab on the bottom of the screen
- Copy the generated id token from your Postman Environment and enter it into this header field.
- Apollo Studio will use introspection to access the schema of your API. If it has worked you should see your schema on the left side of the screen.
- Publish your schema by pressing the
publish
button to the right of the sandbox url input. Because this schema is connected to your DEV APi, using an appropriate naming convention.
- Once your graph is published , you will br automatically navigated to that graphs screen.
- Click the
Explorer
navigation element.
- There is a section
Preflight script
, click theadd script
button.
- Add the following script:
var clientId = explorer.environment.get("cognitoClientId");
var username = explorer.environment.get("cognitoUserName");
var password = explorer.environment.get("cognitoUserPassword");
try {
const response = await explorer.fetch("https://cognito-idp.us-east-1.amazonaws.com/", {
method: 'POST',
headers: {
'X-Amz-Target': 'AWSCognitoIdentityProviderService.InitiateAuth',
'Content-Type': 'application/x-amz-json-1.1'
},
body: JSON.stringify({
"AuthParameters": {
"USERNAME": username,
"PASSWORD": password
},
"AuthFlow": "USER_PASSWORD_AUTH",
"ClientId": clientId
})
});
const body = JSON.parse(response.body);
explorer.environment.set("cognitoClientId", clientId);
explorer.environment.set("cognitoUserName", username);
explorer.environment.set("cognitoUserPassword", password);
explorer.environment.set("cognitoIdToken", body.AuthenticationResult.IdToken);
}
catch (err) {
console.log('ERROR AUTHENTICATING', err);
explorer.environment.set("cognitoClientId", clientId);
explorer.environment.set("cognitoUserName", username);
explorer.environment.set("cognitoUserPassword", password);
}
- Add an env variables json in the
Environment variables
section with values from your Postman/Cognito environment
{
"cognitoClientId": "6um99fv2qtb6f7ise3i037vna",
"cognitoUserName": "mf-int-test@yopmail.com",
"cognitoUserPassword": "PASSWORD"
}
- Click the Preflight script on
- Update the shared headers to reference the new id token variable.
Select queries from your schema and add graphql variables. Then send requests!
query auction_904_subsidy_awards_geojson ($counties: [String]!, $skipCache: Boolean) {
auction_904_subsidy_awards_geojson (counties: $counties, skipCache: $skipCache) {
type
features {
type
id
properties
geometry {
coordinates
type
}
}
}
}