1

I am looking for solution I want to Implement the POST Api Gateway to Get functionality of AWS lambda functions I have tried For Get Request and it works fine

        {
            context.Logger.LogLine("Get Again Request\n");
            var response = new APIGatewayProxyResponse
            { 
                StatusCode = (int)HttpStatusCode.OK,
                Body = $"Hello Again AWS Serverless dd{request.QueryStringParameters["email"]}",
                Headers = new Dictionary<string, string> { { "Content-Type", "text/plain" } }
            };

            return response;
        }

But I want to try it for post Request when I change it to post from

          "RootGet": {
            "Type": "Api",
            "Properties": {
              "Path": "/again",
              "Method": "POST"
            }
          }
        }

I get nothing in the query parameter and then I tried to recieve object

public APIGatewayProxyResponse CustomPortalMessagingEmailForScheduleForm(EmailSendTemplate template,ILambdaContext context)
        {
         if (_sender.SendMail(template))
            {
                return new APIGatewayProxyResponse{
                   StatusCode=(int)HttpStatusCode.OK,
                   Body="Sent Succssfully",
                };
            }
            return new APIGatewayProxyResponse
            {
                StatusCode = (int)HttpStatusCode.OK,
                Body = "Sent Succssfully",
            };
        }

It recieves null and 500 internal error thrown How can I achieve this thing

0 Answers0