Integrate /users/{userId} - DELETE method with delete-user

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

alt text

  1. In the Create method page - Method details section:
    • Method type: Select DELETE.
    • Integration type: Keep Lambda function.
    • Lambda function: Choose the delete-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} - DELETE 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.
    • Name: Fill in userId.
    • Mapped from: Fill in method.request.path.userId.
  2. Expand the Mapping templates section:

    • Click Add mapping template.

    • Content type: Fill in application/json.

    • Template body: Fill in:

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

alt text

  1. Scroll to the bottom, click Save.