Struggling with POST request


#1

Hi all,

I’ve seen other queries around this before, but their fixes don’t seem to be helping me here.

I’ve got a postman collection that’s working and i’m trying to transfer this to a webcore piston for automation purposes. In postman I can see a single Header value and multiple Body values like this:

“method”: “POST”,
“header”: [
{
“key”: “Content-Type”,
“name”: “Content-Type”,
“value”: “application/x-www-form-urlencoded”,
“type”: “text”
}
],
“body”: {
“mode”: “formdata”,
“formdata”: [
{
“key”: “UserId”,
“value”: “{{username}}”,
“type”: “text”
},
{
“key”: “Password”,
“value”: “{{encrypted_password}}”,
“type”: “text”
},
{
“key”: “initial_app_str”,
“value”: “{{baseprm}}”,
“type”: “text”
},
{
“key”: “RegionCode”,
“value”: “{{region}}”,
“type”: “text”
}
]

You can see these in my piston screenshot below:

I’ve tried passing the body keys through as individual variables, then passing through as a data variable, backslashing “” the {}s, but nothing. This is how the request looks:

The server keeps replying with “{“status”:404,“message”:“INVALID PARAMS”}”.

Any ideas on what else I can try?


#2

I am not sure you can override the “Content-Type” that way. You should test what is sent with the a request catcher. I use this website when testing. https://requestcatcher.com/

Try that and post the response if you still have trouble.


#3

That application/x-www-form-urlencoded can be done by changing Request body type from JSON to FORM. Then you can create 4 variables named UserId, Password, initial_app_str, and RegionCode with the values you plan to send and plug those in to the Send variables field.

Another way to do it, closer to what you were trying at first, is to change the Request body type to CUSTOM, Request content type to application/x-www-form-urlencoded, and Request body to UserID=user&Password=pass&initial_app_str=abc&RegionCode=NE.

Depending on the backend you’re working with, it might take the body variable exactly as you have it written, as long as you select CUSTOM for Request body type, application/json for Request content type, and body variable for Request body.


#4

Hi guys,

Just wanted to post back that I got it working (and to help anyone else who searches). ipaterson you were spot on with your “another way”:


#5

sending requests is easy with ReqBin - https://reqbin.com.
you can send requests right from your browser and check the server performance.