title: How do I map path parameters from an API Gateway API to the Request Object of a Java Lambda
body: <p>I have a lambda, written in Java, that accepts a Request Object of the structure </p>
  
  <pre><code>{
    "id": "be1c320a-144f-464d-b32c-38ec7fb4445b",
    "userId": "foobar"
  }
  </code></pre>
  
  <p>When I call this Lambda through the test interface with such an object, it works fine.</p>
  
  <p>I want to create an API where a <code>GET</code> request to</p>
  
  <pre><code>/users/foobar/items/be1c320a-144f-464d-b32c-38ec7fb4445b
  </code></pre>
  
  <p>i.e. of the form</p>
  
  <pre><code>/users/{userId}/items/{id}
  </code></pre>
  
  <p>calls this Lambda.</p>
  
  <p>I have created the API resources <code>/users</code>, <code>{userId}</code>, <code>items</code>, and <code>{id}</code> appropriately. </p>
  
  <p>And I have created the <code>GET</code> method (on <code>/users/{userId}/items/{id}</code>)and associated it to the lambda.</p>
  
  <p>When I test the API, it invokes the lambda, but with null values in the request. I can see it package the <code>path</code> as <code>{"id":"be1c320a-144f-464d-b32c-38ec7fb4445b","userId": "foobar"}</code> in the logs, but that's not being sent in the body.</p>
  
  <p>I have tried creating a template map (and have tried RTFM), but cannot see how to map path parameters to a body.</p>
  
  <p>How do I achieve this mapping?</p>