How to make POST request with __RequestVerificationToken header in Postman

Viewed 348

I want to send a POST request with Postman to receive back information from a database with a list of elements.

Case:

  1. On a Home page, I have a search engine when I'm choosing parameters. URL://example.com
  2. I'm clicking button: Display on a list URL://example.com
  3. I'm receiving list with searched elements URL://example.com/Search/Result

Fist Test

Method: Post

URL: example.com

Headers: Content-Type - application/json

Temporary Headers: which include : __RequestVerificationToken

Body:

{
"options": "1",
"IsMember": "false",
"ID": "2",
"btnShowList" : "true"
}

Result: Status: 200, But in a body I have HTML of whole home page, so probably post was not executed

Second Test

Method: Post

URL: example.com/Search/Result

Headers: Content-Type - application/json

Temporary Headers: which include : __RequestVerificationToken

Body:

{
"options": "1",
"IsMember": "false",
"ID": "2",
"btnShowList" : "true"
}

Result: Status: 404, Not Found

Questions:

Is it possible to do the post if in URL is no query parameres?

Any idea how can I write such a test case?

Have anyone writes post method with dynamic parameters such as eg. __RequestVerificationToken

1 Answers

Receiving an HTML in response is totally normal, especially if the technology used is ASP.net WebForms for instance. To answer some of your questions: It is possible to make a post with no query params. All you need to do is hit the correct url with the expected body

Related