Click here to Skip to main content
14,926,387 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm testing my Rest APIs on Postman, I don't know how to test an API with a POST method which takes an object as a parameter.

Some tutorial say that I should change the type on postman but I can't see this option, my postman control panel is the following(screen):

PostMan.png - Google Drive[^]

What I have tried:

My Rest Api :
public bool IsAvailable([FromBody] Book book)
    return _businessLogic.IsAvailable(book);
My API request:
Where and how I should pass the entity book along with the request?
Updated 4-Dec-20 0:23am

You are trying to pass the book details in the querystring. You need to pass it in the request body instead.[^]
Select the "Body" option which will reveal other options. You can select "x-www-form-urlencoded" and enter your values there, like

Id: 28
Title: Harry Potter

or (probably the better option) select "raw" and enter your data as json

    Id: 28,
    Title: "Harry Potter"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900