why does "request body" have a red background in fiddler? - fiddler

Why is my local Fiddler app displaying a red background for the Composer "Request Body"?
Here's the text I'm using: {'count':'2', 'since_id':'14927799'}
This appears to look like a standard js object to pass as parameters for a service call.
Why does Fiddler display "Request Body" with a red background when I paste in the text I'm using above. I'm guessing Fiddler is saying that the Request Body is invalid. If so then what am I missing here? I'm used to calling services directly through jQuery.....

Fiddler's Composer will show the body background in red if it contains text but the request method is not one that carries a body (POST, PUT, etc).

Related

Am trying to implement Mail reader sampler. But i Am getting the reponse in Folder in the Response data in Jmeter

I am trying to extract an email using Mail Reader Sampler via Jmeter. But i am getting the response in this manner http://imgur.com/0FP2p7c
I am not understanding why it is happening....
Sometimes it happens when you switch View Results Tree listener mode between Text and HTML or XML. The solution is just to restart JMeter or add a new View Results Listener in "Text" mode.
As a workaround you can add Beanshell Listener with the following code:
log.info(sampleResult.getResponseDataAsString());
This way you will be able to see responses in either jmeter.log file or in log window by clicking yellow icon with exclamation sigh in upper-right corner of JMeter main frame:
See Load Testing Your Email Server: How to Send and Receive E-mails with JMeter for more details on testing outbound and inbound emails with JMeter

REST call with install4j

I am using install4j and I want to call rest api's from installer.
I have searched documentation for HTTP request action but not able to find, so my problem is,
I want to sent json with http request using post method, for that I have provided following properties:
Request Headers : Content-Type=application/json,
Form data = key1=value1;key2=value2;....keyN=valueN,
URL=http://localhost:8180/ng/app-setting
But I am not understanding, how to provide authentication details?.
When I run installer file http request execution is start and ask username password after that error message displayed which I was set in properties, But how installer provide exact error message? Because I am not getting what is exact error or what is response message/code?
Please provide the solution and documentation links.
Also let me know the steps how to provide http request (with REST) POST method with json.
how to provide authentication details
To set the authentication programmatically, set the system properties serverAuthUser and serverAuthPassword in the installer.
how to provide http request (with REST) POST method with json.
Currently this is not possible. I've added this to our issue tracker.
Update 2017-11-13
As of 6.1, when you set the "HTTP request method" property of the "HTTP request" action to "POST", a "Custom request body" child property is shown. If selected, the "Content type" and "Request body" properties can be configured.

How to test REST API using Chrome's extension "Advanced Rest Client"

Following the instructions at the link below, I successfully built a REST API for my Django application: http://django-rest-framework.org/tutorial/quickstart.
I can test it by doing the following from the Unix prompt:
curl -H 'Accept: application/json; indent=4' -u root:myPassword http://www.myWebsite.com/users/
It works :)
However, I would like to use the Chrome extension Advanced Rest Client to test this same functionality.
I have installed the extension, but I don't know where/how to put the fields. When I make my educated-guess (as you can see in the screenshot), it rejects it saying "Authentication credentials were not provided"
How/where should I specify my parameters to the REST API?
The discoverability is dismal, but it's quite clever how Advanced Rest Client handles basic authentication. The shortcut abraham mentioned didn't work for me, but a little poking around revealed how it does it.
The first thing you need to do is add the Authorization header:
Then, a nifty little thing pops up when you focus the value input (note the "construct" box in the lower right):
Clicking it will bring up a box. It even does OAuth, if you want!
Tada! If you leave the value field blank when you click "construct," it will add the Basic part to it (I assume it will also add the necessary OAuth stuff, too, but I didn't try that, as my current needs were for basic authentication), so you don't need to do anything.
From the screenshot I can see that you want to pass "user" and "password" values to the service. You have send the parameter values in the request header part which is wrong.
The values are sent in the request body and not in the request header.
Also your syntax is wrong.
Correct syntax is: {"user":"user_val","password":"password_val"}.
Also check what is the the content type. It should match with the content type you have set to your service.
This seems a very old question, but I am providing an answer, so that it might help others.
You can specify the variables in the second screen in the form section, as shown below or in the
RAW format by appending the variables as shown in the second image.
If your variable and variable values are valid, you should see a successful response in the response section.
The shortcut format generally used for basic auth is http://username:password#example.com/path. You will also want to include the accept header in the request.
in the header section you have to write
Authorization: Basic aG9sY67890vbGNpbQ==
where string after basic is the 64bit encoding value of your username:password.
php example of getting the header values is:
echo "Authorization: Basic " . base64_encode("myUser:myPassword");
n.b: I assumed your authentication method as basic. which can be different as well.
Add authorization header and click pencil button to enter username and passwords
The easy way to get over of this authentication issue is by stealing authentication token using Fiddler.
Steps
Fire up fiddler and browser.
Navigate browser to open the web application (web site) and do the
required authentication.
Open Fiddler and click on HTTP 200 HTML page request.
On the right pane, from request headers, copy cookie header
parameter value.
Open REST Client and click on "Header form" tab and provide the
cookie value from the clip board.
Click on SEND button and it shall fetch results.
With latest ARC for GET request with authentication need to add
a raw header named Authorization:authtoken.
Please find the screen shot Get request with authentication and query params
To add Query param click on drop down arrow on left side of URL box.

Fiddler not picking up Content-Type

I'm trying to test some calls but the content-type is text no matter what I do. I try to specify as json or xml but it doesn't matter and not sure why:
I suspect you're getting confused about the Content-Type column, which shows the Content-Type of the response, not the request.
Double-click the Web Session to inspect the request and response using the Inspectors. The Request is shown in the top set of tabs while the Response is shown in the bottom set.

Firefox Add-on RESTclient - How to input POST parameters?

I've installed Firefox RESTclient add-on but , I'm having hard time figuring out how to pass POST parameters. Is there a specific format to do this? Or is there any other tool which can be used to debug an REST API on Mac OS X ?
If you want to submit a POST request
You have to set the “request header” section of the Firefox plugin to have a “name” = “Content-Type” and “value” = “application/x-www-form-urlencoded”
Now, you are able to submit parameter like “name=mynamehere&title=TA” in the “request body” text area field
Here is a step by step guide (I think this should come pre-loaded with the add-on):
In the top menu of RESTClient -> Headers -> Custom Header
In the pop-up box, enter Name: Content-Type and Value: application/x-www-form-urlencoded
Check the "Save to favorite" box and click Okay.
Now you will see a "Headers" section with your newly added data.
Then in the Body section, you can enter your data to post like:
username=test&name=Firstname+Lastname
Whenever you want to make a post request, from the Headers main menu, select the Content-Type:application/x-www-form-urlencoded item that you added and it should work.
You can send the parameters in the URL of the POST request itself.
Example URL:
localhost:8080/abc/getDetails?paramter1=value1&parameter2=value2
Once you copy such type of URL in Firefox REST client make a POST call to the server you want
Request header needs to be set as per below image.
request body can be passed as json string in text area.
I tried the methods mentioned in some other answers, but they look like workarounds to me. Using Firefox Add-on RESTclient to send HTTP POST requests with parameters is not straightforward in my opinion, at least for the version I'm currently using, 2.0.1.
Instead, try using other free open source tools, such as Apache JMeter. It is simple and straightforward (see the screenshot as below)