How to send Rest GET request that contains "#" value in url parameters? - spring

I'm implementing a spring rest webservice. And when i'm sending a GET request to server using following url, it works fine. But when I'm sending a password with # character, server takes only the characters before the #. How can I send parameter value that contains # character?
authentication/authenticate?type=username&username=someuser&password=pass#2033

Related

Jmeter add user

Hi im new to jmeter and my task is to add new http request https://bookstore.toolsqa.com/Account/v1/User
and add user
{
"userName": "user",
"password": "password123"
}
im using this body from https://demoqa.com/swagger/#/Account/AccountV1UserPost but it's still failing.
First of all add HTTP Header Manager and configure it to send Content-Type header with the value of application/json
Add View Results Tree listener, it allows you to see response details, it should give you much more info that your "fails"
When I tried to execute your request and yes, it "failed" with:
{"code":"1300","message":"Passwords must have at least one non alphanumeric character, one digit ('0'-'9'), one uppercase ('A'-'Z'), one lowercase ('a'-'z'), one special character and Password must be eight characters or longer."}
When I add a "one uppercase" and a "one non alphanumeric" character, like ! to the password field it works normally (assuming that there is no user with this username)
Demo:
More information: REST API Testing - How to Do it Right

How to get URL having ".../?where={'key1' : 'value1' , 'key2' : 'value2':.........}" in Jmeter http request

I need to load test one Python api in below URL format:
//IP:PORT/Sub_Part/?where={"KEY1":"VALUE1","KEY2":"VALUE2","KEY3":"VALUE3"}
I tried to pass the key value pair through csv as well as directly in http request but getting error message.
java.net.URISyntaxException: Illegal character in query at index 47:
http://IP:PORT/Sub_Part/?where={"KEY1":"VALUE1","KEY2":"VALUE2","KEY3":"VALUE3"}
Here key and value are dummy data I have placed here for easy understanding.
Please help me with correct syntax for this URL.
Thanks in advance for all your help.
In REST APIs, JSON objects are typically sent (POST) or returned in the body of the request. They are not typically encoded as part of the URL.
For a GET request, you can either pass the information as segments in the url or as querystring parameters.
For more details refer here, How to send a GET request with a "/" in the query
As per HTML URL Encoding Reference:
URLs can only be sent over the Internet using the ASCII character-set.
so you need to define the request in JMeter's HTTP Request sampler as follows:
Pay attention to URL Encode? checkbox, it has to be ticked otherwise the parameter will be sent "as is"
Another option is using __urlencode() function like:
http://IP:PORT/Sub_Part/?where=${__urlencode({"KEY1":"VALUE1"\,"KEY2":"VALUE2"\,"KEY3":"VALUE3"})}
which will generate an encoded sequence which you could use in the URL path:
%7B%22KEY1%22%3A%22VALUE1%22%2C%22KEY2%22%3A%22VALUE2%22%2C%22KEY3%22%3A%22VALUE3%22%7D
as you can see, all non-ASCII characters where removed.
Check out Apache JMeter Functions - An Introduction to learn more about JMeter Functions concept.

In JMeter Post Data Not Sent In Request When Certain Character Strings Are Included

In a test plan that I am trying to execute, there is a step that includes a post request with post data. One of the parameters in the post data includes special characters. The parameter name is '__RequestVerificationToken'. When the parameter name is spelled correctly, the request is sent with no post data included. The request fails. However when the parameter is changed slightly, post data will be included with the request. Because the correct parameter names are not sent, the request also fails. Below is a list of parameter names that do and do not break the sending of post data.
Parameter names that do break the sending of post data:
'__RequestVerificationToken'
'__RRequestVerificationToken'
'**RequestVerificationToken'
Parameter names that do not break the sending of post data:
'__TRequestVerificationToken'
'RequestVerificationToken'
Is there anything that I can do have my parameter name sent correctly without dropping post data from the request?
Did you try encoding them using 2 options:
In Http Request check the checkbox encode in the parameters table
Use function __urlencode

Can not receive proper parameters in my WCF service (jQuery, ajax)

I have a method on my client side. And I pass "{'id':'1'}" as data and I got a small problem with double quotes "{"id":"1"}"):
But on server I got zero:
What am I doing wrong?
and attributes for WCF method:
Why did you add doublequotes to parameters? They must be send as json. In your exaple you send a string without key! Parameters must be set as
parameters = {id: 1}
Then server correctly receives data.

Flex 4 - Sending string (such as JSON) using HTTPService

When I use HTTPService.send(paramter) as a POST request, the web server does not appear to see variable "parameter" if it is a string. The server sees the parameter if it's an Object, but I'm looking to use something like httpservice.send(JSON.encode(object)); Is this possible?
Why not use the actual request objects.
in your service define request objects and post them or send them as get if you please.
Sample code here: http://pastebin.com/ft7QW2vg
Then just call .send on the service.
on the server you can simlpy process if with request.form (Asp)
Failing which why not append it to the url with a binding expression. (you would need to encode it since you would be more or less faking a url or a get behaviour).

Resources