Testing the service

Now that we have all the necessary pieces set up, let's go back to the Amazon API Console and try testing the service. For that, follow these steps:

  1. Open the /WeatherServiceFunction/ANY file under the Resources option, and hit the Test option.
  2. Under the method, select Get as the option.
  3. For the query string, we need two inputs: the ZIP code of the city for which you want to query the current weather and the OpenWeatherMap's API key. To do this, create a query string such as zip=<<zip-value>>&appid=<<app-id>>. In this, replace the italicized values with actual inputs and form a string such as zip=10001&appid=abcdefgh9876543qwerty.
  4. Hit the Test button at the bottom of the screen to invoke the API and the Lambda function.
  5. If the test is successful, you will see a response with Status: 200, and in the response body, you will get the weather information in a JSON format, as follows:
The Method Test

If there's an error in test execution, check the logs in the bottom half of the screen to debug the issue.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset