In this step, you test queries for the AppSync API you have configured. AppSync provides built-in feature to test the queries.
-
Goto AWS AppSync console, click on the Queries menu in the left. Select Mutation in the explorer and click on the + button. Remove the getTask query method from the explorer using x icon.
-
It will include addTask mutation method.
-
Select addTask mutation method and provide values of the parameters - id = 1 and description = my first task. Click on the Run button.
-
It runs successful and the response from the Lambda function is shown. You can also see a record created in the DynamoDB table.
Response
Table Record
-
Next, select Query in the explorer and click on the + button. Remove the addTask mutation method from the explorer using x icon.
-
Select getTask mutation method and provide values of the parameters - id = 1. Click on the Run button.
-
It runs successful and the response from the Lambda function is shown.
-
Both queries are working well. It is time to write a client which can call the API. But before that we need to make note of few things. In the AppSync console, click on the Settings menu option in the left. Make note of the API URL and the API Key as you need it later when you build the client for the API. For the workshop, you are using API Key for the authentication. But in actual production, you might prefer other methods such as IAM, Amazon Cognito or OpenID Connect.
-
Great. Let’s setup the environment where the client code is built.