简体   繁体   中英

how to pass body parameters in URL in postman?

I am trying to pass raw body data in the POSTMAN URL section. how I can achieve this? have a look here: I have this URL in postman with the "GET" method http://localhost:8888/wordpress/wp-json/gh/v3/contacts and I am passing this data in the body

{
"query":{
"tags_include" : 92
}
}

i have to pass id(92) in the URL of POSTMAN how can i do this?

It can be done simply by passing parameters just in URL:

http://localhost:8888/wordpress/wp-json/gh/v3/contacts?tags_include=92

Follow as per below screenshot

在此处输入图片说明

localhost:8888/wordpress/wp-json/gh/v3/contacts/:{{tags_include}}

If I have understood correctly, you are getting the raw data from some other URL and now you want to pass its "tags_include" parameter value in the URL specified above.

What you need to do is, use the above URL(that I edited) but, for it to work, you need to write the following code in the tests section of postman. Use this code in the test section of the request that responds with the data(that you specified above).

Here is the code:

var body = JSON.parse(response body); postman.setEnvironmentVariable('tags_include', body.query.tags_include);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM