Integrate /users/{userId} - GET method with get-user

  1. Go back to the Resources section of the UsersAPI API in API Gateway console.
  2. Select /users resource.
  3. Click Create resource.

alt text

  1. In the Create resource page:
    • For Resource path: Choose /users

    • For Resource name: Fill in {userId}.

      Be aware of the two brackets: { and }.

    • Click Create resource.

alt text

  1. Click on the /users/{userId} resource you’ve just created.
  2. Click Create method.

alt text

  1. In the Create method page’, Method details section:
    • Method type: Select GET.
    • Integration type: Keep Lambda function.
    • Lambda function: Choose the get-user function.

alt text

  1. Keep other settings as default.

    • Scroll to the bottom and click Create method.
  2. You will be redirect to the detail of the /users/{userId} - GET method.

alt text

  1. Open the Integration request tab.
  2. In the Integration request settings section, click Edit.

alt text

  1. In the Edit integration request page:

alt text

  1. Expand the URL path parameters section, click Add path parameter.

alt text

  • Name: Fill in userId.
  • Mapped from: Fill in method.request.path.userId.

alt text

  1. Expand the Mapping templates section, click Add mapping template.

alt text

  • Content type: Fill in application/json.

  • Template body: Fill in:

    {
      "id": "$input.params('userId')"
    }
    

alt text

  1. Scroll to the bottom, click Save.