Response code:400 Response message:Bad Request Jmeter api testing with JIRA with POST method - api

When try to create issue in Jira using the JMeter API with POST method, it does not allow to create issue and it shows error below.
I uploaded my all configuration image.
Can anybody correct me?
Thanks in advance.
Error message:
2020-12-27 19:48:35,841 ERROR o.a.j.p.h.s.HTTPJavaImpl: readResponse: java.io.IOException: Server
returned HTTP response code: 400 for URL: https://learntestapi.atlassian.net/rest/api/2/issue
2020-12-27 19:48:35,841 ERROR o.a.j.p.h.s.HTTPJavaImpl: Cause: java.io.IOException: Server returned
HTTP response code: 400 for URL: https://learntestapi.atlassian.net/rest/api/2/issue
Screenshots (2 images attached)

I think you're using an incorrect URL, i.e. it has to be:
/rest/api/2/issue/createmeta/QA/issuetypes/{issueTypeId}
to identify the issueTypeId you need to first execute call to the following endpoint:
/rest/api/2/issue/createmeta/QA/issuetypes
then choose an appropriate issue type and substitute it in the first request.
More information: Jira REST API examples
Also make sure that your HTTP Header Manager is configured to send Content-Type header with the value of application/json

Related

Why does get my response error message got truncated

I'm new to the WorldPay integration development.
I'm having difficulty when I am sending an authorization request from one of our applications and I got this response from the api .
Client error: POST https://try.access.worldpay.com/payments/authorizations resulted in a 400 Bad Request response: {"errorName":"bodyDoesNotMatchSchema","message":"The json body provided does not match the expected schema","validationE (truncated...)
My problem is I was unable to see the complete error message because the response has been truncated. Is there a way to prevent that issue?

how to send Content-Length in rest assure ,Since encountering error that "Content-Length header already present"

I am performing post operation using RestAssure and where in header I am passing Content-Length as below -
queryParam().header("Content-Length", "value_Of_It")
and due to that, I am encountering the error that "Content-Length header already present".
it would be great if someone can help me out to resolve it ?
Caused by: org.apache.http.ProtocolException: Content-Length header already present
And below are the headers gets added in postman by default,So while automating in Rest Assure d i need t pass them if not then how to resolve since getting 400 Bad request ? -
Rest-Assured automatically add Content-Length to header when doing the POST request. I've already tested with Postman proxy to see all information in Rest-Assured request.
Code:
given().proxy(5555)
.body("test")
.post("http://postman-echo.com/post");
If I add another Content-Length, I will get the same error as yours.

REST API call works at Postman but not at Jenkins

I'm facing a problem that seems to be simple. I'm trying to call a REST API from Jenkins build step and it's not working.
I make this call from postman and it works just fine, but from Jenkins, it doesn't. Bellow are some pictures of my configurations.
Postman Settings
As you can see on this image, at postman my request works perfectly.
Jenkins Settings
At this image you can see that I'm using the same settings at Jenkins, although it doesn't work.
Finally, the error message that is presented when I try to run the Jenkins.
Started by user Hugo da Silva da Silva
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/Power BI - Atualizador mensal
HttpMethod: POST
URL: https://login.windows.net/7348b8c4-3705-4965-b18a-c02e2d5a28eb/oauth2/token
Content-Type: application/x-www-form-urlencoded; charset=ISO-8859-1
Accept: application/json
Sending request to url: https://login.windows.net/7348b8c4-3705-4965-b18a-c02e2d5a28eb/oauth2/token
Response Code: HTTP/1.1 400 Bad Request
ERROR: Build step failed with exception
hudson.AbortException: Fail: the returned code 400 is not in the accepted range: [[100‥399]]
at jenkins.plugins.http_request.HttpRequestExecution.responseCodeIsValid(HttpRequestExecution.java:369)
at jenkins.plugins.http_request.HttpRequestExecution.processResponse(HttpRequestExecution.java:379)
at jenkins.plugins.http_request.HttpRequestExecution.authAndRequest(HttpRequestExecution.java:295)
at jenkins.plugins.http_request.HttpRequestExecution.call(HttpRequestExecution.java:226)
Caused: java.lang.IllegalStateException
at jenkins.plugins.http_request.HttpRequestExecution.call(HttpRequestExecution.java:229)
at jenkins.plugins.http_request.HttpRequestExecution.call(HttpRequestExecution.java:79)
at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
at jenkins.plugins.http_request.HttpRequest.perform(HttpRequest.java:398)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1856)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:428)
Build step 'HTTP Request' marked build as failure
Finished: FAILURE
Anybody has ever faced a similar situation? Any tip?
Best Regards
Posting here the solution given by my friend #brunolmfg.
The problem was the body content format. I was posting it using json format, whereas I shoud post it as url encoded. Here is the body content that worked:
grant_type=client_credentials&resouce=XXX&client_id=YYY&client_secret=ZZZZ

POSTMAN - unable to fetch all the RESPONSE HEADERS including TOKEN

I am trying to access the token from the Response Header of the POST request. However, when I POST the request in POSTMAN it doesn’t show all the Response headers which I see on the chrome dev tool.
The KEY in the response header I am after is :
location: https://app.rm.dev/auth/callback/?token=
Also, I can see when I POST the request I receive a GET request in the chain in the Console window [image attached]. I tried but was unable to get all the Response Headers, therefore is there a way I can copy the GET request Token value from the Console window shown in the Image?
Found the solution, just needed to toggle off Auto redirect option in Postman Settings.

PUT/POST request in SOAPUI giving 403 forbidden, while same request working fine in rest client Postman

There is no authentication on server side so authentication should not be issue.
URL format: PUT
https://localhost/api/v1/protections?integrationKey=111&userKey=1111&group=111&category=foo
Payload:
{"action":"BLOCK"}
This is working fine in Postman.
In SOAP UI , I am giving input as under:
EndPoint: https://localhost
Resource: /api/v1/protections
Parameters:?integrationKey=111&userKey=1111&group=111&category=foo
in Media type, I am selecting "application/json"
and entering {"action": "BLOCK"} but getting "Wed Jan 20 16:25:27 PST 2016:DEBUG:Receiving response: HTTP/1.1 403 Forbidden
"
Is there any suggestion to get the output in SOAP UI.
Depending on the server where the rest is exposed service generates an HTTP 403, you should verify that server is and thus find the fastest response.
Also try making a GET request from the browser to see if you can answer correctly because problem lock your machine to the server.
As is https, it may be that you lack some certificate set SOAPUI. possibly Postman you use already has configured. Try to check this setting.
In my case, I missed the Header "User-Agent" and "accept". I put in Soap UI and Works.
In Postman, this headers it put automatically.