'How to get path parameter in spring cloud function

I have a java application written using spring-cloud-functions and deployed in aws lambda which connects to aws api-gateway

I have a 'GET' api(let's say /employees/{employeeId}) which takes an input parameter({employeeId} in this case) and returns the result(employee details for the given employeeId) corresponding to the parameter.

I tried googling but could not find a way to set this up such that I get the {employeeId} passed to my spring-cloud-function code and act accordingly. How do I get the parameter in the java code?

Can anyone suggest how to set this up in api-gateway and get the same parameter in my java lambda code?

Thanks.



Solution 1:[1]

I used REST API with lambda integration. We need to convert the path params and query params to an event object that the lambda can consume.

So here goes, in integration tab:

URL Query String Parameters

Mapping Templates

You can refer here for details: AWS Knowledge Centre Article

Same logic can be applied to path params as well.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vasco