I am working aws lambda with API gateway. for my compare-yourself-api resource I created a sub resource called field (please refer screenshot).
when I am testing it, I can see the request uri: /compare-yourself-api/test1.
I can see test1 in request but not sure how to access that field in my functionhandler. I tried Map<String,String>
as input in place of object but still the same issue. I was getting empty value.
my output from Gateway Method Test screen is: "{} Hello from Lambda!"
Empty curly braces with out any object.
Here is my lambda function.
package com.amazonaws.lambda.demo;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
public class LambdaFunctionHandler implements RequestHandler<Object, String> {
@Override
public String handleRequest(Object input, Context context) {
context.getLogger().log("Input: " + input);
// TODO: implement your handler
return input+" Hello from Lambda!";
}
}
Please suggest me how can I get the pathvariable in Lambda function handler java.