Trying To Insert Key/value Pairs To The Request Body With Postman - postman

I am trying to insert key/value pairs to the request body in Postman, but I cannot do it! I click/double-click the body area, but nothing seems to happen.
I am stuck at this screen:
How can I add another JSON entry manually?

Looking at the screen shot, looks like you are trying to edit Response body rather than the Request body.
Postman only allows editing request body (which is logical).
If you want to use this response body contents in other request, copy and paste it in other request body and then edit it.

Related

Save example in Postman

I want to save examples in postman. I know how to do that. But request is saved with variable placeholders if request contains any.
For example if request is something like:
{
id: {{someId}}
}}
In this example look the same way as request body - with variable place holder. Now I open console, open request body, copy and then paste in example's request. It is time consuming. Is there a way to force postman to save example with variable values?

What is the difference between Params and Body in Postman

This might be a really simple question but I can't seem to find a clear answer.
In postman, what is the difference between the Params and the Body tabs?. I noticed that when I was trying to perform a PUT request, if I am to add the key and value in Params my PUT request doesn't seem to update what I intend to update but if I perform the PUT request in Body and have the form-data selected than the expected update happens.
So what exactly are the differences?
Params correspond to the request parameters that are appended to the request URL.they are most used with GET requests. On the other hand, Body is the actual request body (usually it defines the request payload or the data that needs to be processed by the request). PUT and POST requests read usually the data from the body of the request and not from the params.

How to access the true RAW request body from post man on a pre-request script?

I'm trying to authenticate myself against an API. This API uses the raw body from the request to create the hash that it will use to authenticate against my token.
For testing purposes, I'm using postman with a pre request script to create the hash. Everything works fine, with one exception:
In the code tab I have this
however if on the pre request script I dump the value of the request body I get by using request.data I obtain
The problem is, its not exactly the same string, then the value retrieved by request.data creates a hash with a different body that the server uses to create its hash (the server uses the one beautified with line endings and tabs). This is the script where I use the request body content:
So unless someone have an idea of how to retrieve the json body exactly on the format it was written, pretty much seems I cant use postman for this
thanks!
EDIT: I don't know if this existed 5 years ago when the original Question was posted, but it's available in PostMan 8.12.2 at least.
When you have a request open in Postman, show the "Code" pane at the right by clicking the </> button seen in the right-hand toolbar.
Then in the dropdown header for code type, choose "HTTP".
The line numbers in the HTTP snippet are significant -- in my screenshot, the last four displayed lines are concatenated into line 6 of the actual HTTP.
just changed the post body tab to
new post body
and it went just fine. Not really the best solution i was expecting, but does the job :)

why postman api body is not responding?

I'm trying to make a post request through postman. I selected the post option and when I'm trying to add something to the body, I could not do it as the entire body is not editable. Has anyone faced this kind of issue before? The body is part is not responding at all.
You are trying to edit the body of the response. To modify the body parameter, scroll up and select the "Body" tab.
If you would like to insert raw JSON, switch to the raw selection under the Body tab

Kosher way to send data to REST service

Suppose, I have a GET, PUT, POST and DELETE methods. I want to have them.
How should a data be sent to each of these methods?
I can send parameter in URL. Parse URL and get value from it.
A value can be sent inside body of request.
A value can be sent inside request's params (?).
What I want as an answer, are links to specifications of how request is made, what is sent, what is used for what. Also, I want 'English' explanation :-)
Also, links on each method. Specifically, I'm interested in passing values to service for each method.
I want to understand how it works on low level.