# How to define POST parameter in serverless.yml

**URL:** https://forum.serverless.com/t/how-to-define-post-parameter-in-serverless-yml/2418
**Category:** Serverless Framework
**Tags:** aws
**Created:** [August 4, 2017, 4:28pm UTC](https://forum.serverless.com/t/how-to-define-post-parameter-in-serverless-yml/2418 "2017-08-04T16:28:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![yasa83\_jsm](https://avatars.discourse-cdn.com/v4/letter/y/a9a28c/32.png) [@yasa83\_jsm](https://forum.serverless.com/u/yasa83_jsm)
#### Post date: [August 4, 2017, 4:28pm UTC](https://forum.serverless.com/t/how-to-define-post-parameter-in-serverless-yml/2418/1 "2017-08-04T16:28:30Z")

</div>

Hi,

We want to define POST parameter in the serverless.yml file so that the definition in yml file can used to create model and update the method request body during

sls deploy.

With following post value,

{servicename: “someserver”, userID: “some\_user\_id”, username: “username1”, requestedOn: “date”, request: {HTTPVerb: “sometext”}}

We want to create model with name auditLog and following schema,

{  
“title”: “auditLog”,  
“type”: “object”,  
“properties”: {  
“serviceName”: {  
“type”: “string”  
},  
“userID”: {  
“type”: “string”,  
“format”: “email”  
},  
“username”: {  
“type”: “string”  
},  
“requestedOn”: {  
“type”: “string”  
},  
“request”: {  
“type”: “object”,  
“properties”: {  
“HTTPVerb”: {  
“type”: “string”  
}  
}  
}  
}

update the model in method request body model.

Thank  
Satheesh

---

<div class="post-metadata">

### Author: ![DavidWells](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/davidwells/32/201_2.png) [@DavidWells](https://forum.serverless.com/u/DavidWells)
#### Post date: [August 4, 2017, 9:19pm UTC](https://forum.serverless.com/t/how-to-define-post-parameter-in-serverless-yml/2418/2 "2017-08-04T21:19:31Z")

</div>

Sorry not following you here.

What is the question? =)

---

<div class="post-metadata">

### Author: ![yasa83\_jsm](https://avatars.discourse-cdn.com/v4/letter/y/a9a28c/32.png) [@yasa83\_jsm](https://forum.serverless.com/u/yasa83_jsm)
#### Post date: [August 7, 2017, 9:14am UTC](https://forum.serverless.com/t/how-to-define-post-parameter-in-serverless-yml/2418/3 "2017-08-07T09:14:27Z")

</div>

Hi David,

I want to define something similar below in serverless.yml, so that when I execute “_serverless deploy_”. The deploy should generate the following structure in API gateway.

Something like this in the definition, (But the definition wrong).

```
   functions:
      health:
        handler: handler.health
        description: Stores the log details
        Type: "AWS::ApiGateway::RestApi"
        events:
          - http:
              path: health
              method: post
              cors: true
              authorizer: apiAuth
              request:
                parameters: 
                  application/json: '{"title":"auditLog","type":"object","properties":{"serviceName":{"type":"string"},"userID":{"type":"string","format":"email"}}}'

```

Should generate the model with the following definition.

![api_model_def](https://yyz2.discourse-cdn.com/flex036/uploads/serverless/original/1X/e9c9ebe8cdd9e3bdd1f9acbe6bfa693de80ca72b.png)

The generated model should be assigned to the request body of the method POST.  
(APIs → dev-audit-api → Resource → health \> POST)

Please let me know, if you can help.

Thank you,

Satheesh

---

<div class="post-metadata">

### Author: ![yasa83\_jsm](https://avatars.discourse-cdn.com/v4/letter/y/a9a28c/32.png) [@yasa83\_jsm](https://forum.serverless.com/u/yasa83_jsm)
#### Post date: [August 7, 2017, 1:47pm UTC](https://forum.serverless.com/t/how-to-define-post-parameter-in-serverless-yml/2418/4 "2017-08-07T13:47:51Z")

</div>

Hi,

On to my future investigation and googling through I found the Serverless AWS Documentation plugin which helps in deploying model from yml as well as documentation.

You can find the more on there,

> **[9cookies/serverless-aws-documentation](https://github.com/9cookies/serverless-aws-documentation)**
>
> serverless-aws-documentation - Serverless 1.0 plugin to add documentation and models to the serverless generated API Gateway

Thanks,

Satheesh
