title: Serverless, API Rest, get body on Lambda POST
body: <p>I have a Lambda POST function, I'm sending a json body for testing as:</p>
  <pre><code>{
    &quot;id&quot;: 3
  }
  </code></pre>
  <p>But I don't know how to read that body on my code.</p>
  <p>At first I had a GET API, I called that API with:</p>
  <p>POST: <a href="https://XXX.execute-api.us-east-2.amazonaws.com/dev/getData/123" rel="nofollow noreferrer">https://XXX.execute-api.us-east-2.amazonaws.com/dev/getData/123</a>
  (Content-Type: application/json)</p>
  <p>so in my code I had:</p>
  <pre><code>export const handler = async (
    event: { pathParameters: { ID: any } }
  ): Promise&lt;any&gt; =&gt; {
      console.log(event.pathParameters.ID) // 123
  </code></pre>
  <p><code>serverless.yml</code> was:</p>
  <pre><code>functions:
    feelookup:
      handler: src/functions/getData.handler
      events:
        - http:
            path: /getData
            method: get
            cors: true
  </code></pre>
  <p>But now I don't know how to read the body on POST</p>
  <p>Edit: I tried by <code>event.body</code> but it doesn't existe body.</p>
  <p>Here I have console.logs of <code>event</code> and <code>args</code> (from <code>CloudWatch</code>):</p>
  <pre><code>export const handler = async (
    event: any,
    args: any,
  ): Promise&lt;any&gt; =&gt; {
    console.log('event', event);
    console.log('args: ', args);
  </code></pre>
  <p><a href="https://i.stack.imgur.com/ohScJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ohScJ.png" alt="enter image description here" /></a></p>