title: Amazon Web Services - API Gateway
body: <p>I am trying to integrate AWS Api Gateway and AWS Lambda, <br>
  I am able to call the Lambda function and get a response. <br>
  But when I use the AWS API Gateway and call my Lambda function using a GET method, <br>
  I am unable to pass parameters using a query string.</p>
  
  <p><strong>Here's my Handler -</strong><br></p>
  
  <pre><code>package example;
  
  import com.amazonaws.services.lambda.runtime.RequestHandler;
  import com.amazonaws.services.lambda.runtime.LambdaLogger;
  import com.amazonaws.services.lambda.runtime.Context;
  
  public class Hello implements RequestHandler&lt;Request, Response&gt;{
      public Response myHandler(Request request, Context context) {
  
          LambdaLogger logger = context.getLogger();
          logger.log("received a Lambda request");
          logger.log("Name param contains: "+request.getName()+" Age param contains: "+request.getAge());
          String greetingString = String.format("Hello "+request.getName()+", you are "+request.getAge()+" years old");
         return new Response(greetingString);
      }
  
      public Response handleRequest(Request arg0, Context arg1) {
          // TODO Auto-generated method stub
          return null;
      }
  }
  </code></pre>
  
  <p><strong>Here's the Request class -</strong><br></p>
  
  <pre><code>package example;
  
  public class Request {
      String name;
      String age;
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getAge() {
          return age;
      }
  
      public void setAge(String age) {
          this.age = age;
      }
  
  }
  </code></pre>
  
  <p><strong>Here's the Response class -</strong> </p>
  
  <pre><code>package example;
  
  public class Response {
      String greetings;
  
      public String getGreetings() {
          return greetings;
      }
  
      public void setGreetings(String greetings) {
          this.greetings = greetings;
      }
  
      public Response(String greetings) {
          this.greetings = greetings;
      }
  
      public Response() {
      }
  
  }
  </code></pre>
  
  <p><strong>Here's my test String for the Lambda function for which I get a successful response -</strong> </p>
  
  <pre><code>{
    "name": "Aniruddha",
    "age": "25"
  }
  </code></pre>
  
  <p><strong>Success response to the Lambda call -</strong></p>
  
  <pre><code>{
    "greetings": "Hello Aniruddha, you are 25 years old"
  }
  </code></pre>
  
  <p><strong>Now here's the problem,<br>
  I configured an AWS API Gateway for a Get method,<br>
  Expected query parameters are -</strong> </p>
  
  <pre><code>?name=aniruddha&amp;age=25
  </code></pre>
  
  <p><strong>I get a response body -</strong></p>
  
  <pre><code>{
    "greetings": "Hello null, you are null years old"
  }
  </code></pre>
  
  <p><strong>Response Headers -</strong></p>
  
  <pre><code>{"Content-Type":"application/json"}
  </code></pre>
  
  <p><strong>Logs -</strong> </p>
  
  <pre><code>Execution log for request test-request
  Mon Nov 21 16:28:10 UTC 2016 : Starting execution for request: test-invoke-request
  Mon Nov 21 16:28:10 UTC 2016 : HTTP Method: GET, Resource Path: /aniruddhaagw
  Mon Nov 21 16:28:10 UTC 2016 : Method request path: {}
  Mon Nov 21 16:28:10 UTC 2016 : Method request query string: {name=aniruddha, age=25}
  Mon Nov 21 16:28:10 UTC 2016 : Method request headers: {}
  Mon Nov 21 16:28:10 UTC 2016 : Method request body before transformations: null
  Mon Nov 21 16:28:10 UTC 2016 : Endpoint request URI: https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/arn:aws:lambda:us-east-1:520784750730:function:aniruddhaLambda/invocations
  Mon Nov 21 16:28:10 UTC 2016 : Endpoint request headers: {x-amzn-lambda-integration-tag=test-request, Authorization=**************************************************************************************************************************************************************************************************************************************************************************************dfb8a3, X-Amz-Date=20161121T162810Z, x-amzn-apigateway-api-id=h0b98tua9i, X-Amz-Source-Arn=arn:aws:execute-api:us-east-1:520784750730:h0b98tua9i/null/GET/aniruddhaagw, Accept=application/json, User-Agent=AmazonAPIGateway_h0b98tua9i, Host=lambda.us-east-1.amazonaws.com}
  Mon Nov 21 16:28:10 UTC 2016 : Endpoint request body after transformations: null
  Mon Nov 21 16:28:10 UTC 2016 : Endpoint response body before transformations: {"greetings":"Hello null, you are null years old"}
  Mon Nov 21 16:28:10 UTC 2016 : Endpoint response headers: {x-amzn-Remapped-Content-Length=0, x-amzn-RequestId=7e29d831-b007-11e6-83cc-8b56e673337e, Connection=keep-alive, Content-Length=50, Date=Mon, 21 Nov 2016 16:28:10 GMT, Content-Type=application/json}
  Mon Nov 21 16:28:10 UTC 2016 : Method response body after transformations: {"greetings":"Hello null, you are null years old"}
  Mon Nov 21 16:28:10 UTC 2016 : Method response headers: {Content-Type=application/json}
  Mon Nov 21 16:28:10 UTC 2016 : Successfully completed execution
  Mon Nov 21 16:28:10 UTC 2016 : Method completed with status: 200
  </code></pre>