POST

Introduction

Valve for performing HTTP POST requests.

Configuration

Valve name: HttpPost

Common HTTP valve configuration can be found here.

NameDescriptionDefault valueMandatory

content_type

Media type of content.

N/A

Example for posting form data

{
    "name": "HttpPost",
    "config": {
        "url": "https://demo1827626.mockable.io/tenant1/oauth2/v2.0/token",
        "destination": "default",
        "parameters": {
            "client_id": "myid",
            "scope": "https%3A%2F%2Ftest.tenant1%2F.default",
            "client_secret": "mysecret",
            "grant_type": "client_credentials"
        },
        "content_type": "application/x-www-form-urlencoded"
    }
}

Example for posting JSON data

{
    "name": "HttpPost",
    "config": {
        "url": "https://demo1827626.mockable.io/tenant1/customers/find",
        "destination": "default",
        "content": {
            "personalIdentityNumber": "{{{request.ssn}}}"
        },
        "headers": {
            "Authorization": "Bearer {{{state.body.access_token}}}"
        },
        "content_type": "application/json"
    }
}