I am posting a request using post request method but the log is showing it is taking empty data due to which action is not being perfomed
${auth}= Create List username password
&{key}= Create Dictionary prokey=Key:uiuij343jhkjk
Create Session alias uri auth=${auth} disable_warnings=true
${response}= POST Request alias ${delete_uri} data=${key}
logs show:
Post Request using : alias=alias, uri=******, data=empty, headers=None, files=None, allow_redirects=True
INFO ${response} = Response [200]
Note:
data type is form-data
any help appreciated , how would i pass data to the post request.
Related
I a web site that returns parts of web page as response data when a POST request is submitted. I have tried pasting the URL into the extractor, but it returned no data. Is there a way to extract the data from a POST response ?
I'm creating a session along with a name and Service URL followed by performing a post request with passing a file(XML file in the form of Dictionary) as a parameter.
But response code is '500 'instead of '200' (i.e. success).
Library Used:
Library RequestsLibrary
Snapshot of code used in Testcases section:
create session session http://myservice.com/method #(Just an example)
${response}= Post Request session /post files=${files}
Error: Not getting any error. Moreover Line of Code which has "Post
Request" is passing. But the status of response code is "500"
(Supposed to be "200").
A 500 response code means your request worked, but that the server threw an error. You need to check the server logs for more information.
There is a initial request going to the server which should retrieve the CSRF token and use that token id in post request header.
if that does not happen any POST requests to the server will return that error.
In the above screen shot, where token is the request to get the CSRF token Id, If I run the test this will generate one dynamic random token ID. But I need to pass the generated token ID in the post request through Header Manager. How can it possible. If yes, Can any one suggest some way to do that.
I resolved it by using User defined variables and Regular Expression Extractor to pass the parameters from one request sampler to another.
In the firs request add a postprocesor of the request. if the response is un json format user json Extractor, in json Extractor define a variable that read the token
In the second request add a header Manager an refer varaible declare in json Extractor in the following way in value cell, ${variable}
I am trying to login to a site, and then view user details.
The API documentation from the site is:
LogOn : All Calls with JSON and return JSON type
post - https://www.bit2c.co.il/Account/LogOn {UserName:'',Password:'',SecondFactor:[optional]}
return true if OK , error list of strings if not
Balance - GET https://www.bit2c.co.il/Account/Balance
return UserBalance as JSON
I've tried connecting to the site using
import requests
session=requests.session()
session.auth = ("username", "pass")
session.post("https//www.bit2c.co.il/Account/Balance")
but i am getting response 200 and the response content is "you must login".
What am I doing wrong ?
What kind of session? What is on server-side? Can you post the raw request/response pair(s)?
If PHP or ASP runs on server-side, you must capture the Set-Cookie header of the response to the login request, find the session cookie and in consequent requests you must set the Cookie header with the session cookie name and value captured previously.
I am calling webservice which takes two parameters like category and salt then provide the json output with constructed url but url is not working. PFA url
Service Url:
http://qalisting.corelogic.com/ChaseListingServices/v1.5/test
constructed URL: http://qalisting.corelogic.com/ChaseListingServices/v1.5/listings/search/test/0/4e9c00b32794edfeba257aa0c74f500b
Looking at the error message on your constructed URL, the Service needs to be called using a POST and not a GET Request.
Responding to your comments: it's not the URL which is the problem but how it is called. When you follow a link, such as the one you posted - the browser sends it as a GET request. The service is expecting the JSON arguments as part of the "body" of a POST request. This must be done programmatically.