I'm using RestSharp 108.0.1 in my visual studio project to send http request. In my request I need to send some parameter with values like 'Ze4mdL8ed%2BXinfpW7vg2qRkX9EyQaicauJEF94TZpJEwajJ8KqXleQ%3D%3D'. When I'm sending the same request through Postman (V 9.31.6), I'm getting proper result, but in visual studio it says unauthorized. I'm assuming there is some automatic encoding taking place in the visual studio which is changing the value of the parameter and thus the server is unable to authenticate with the new encoded value which is not happening in Postman and hence I'm getting proper response. I have very limited knowledge on encoding. I don't know what encoding Postman uses to send the request. Can someone help me to resolve this in visual studio with a function which will take care of the all the encoding and send similar encoded request that Postman does.
Thanks in advance.
Related
In our express (with typescript) app, we are calling an external api and normally we would send a http GET using axios like
foo/api/search/hello world where hello world is entered by the user of a web app. We call encodeURIComponent on the parameter so we will send foo/api/search/hello%20world to the external api. And this works fine until someone tried to enter something that is non-ascii, s.a. hello tânia; this causes us to send foo/api/search/hello%20t%C3%A2nia to the external api and we got a http 400 back.
Is this something that the external api should handle or we shall handle it on our side?
Either way, how to handle this?
So in general the encodeURIComponent() function encodes all special characters into their matching UTF-8 encoding, see here. So your client is doing everything right, but it seems like your server which is receiving the HTTP GET is for some reason not capable of correctly handling the UTF-8 encoded URI.
I need to make stress test with method POST (SOAP API). I tried to use function ${_UUID} to make UUID like abec119d-2d8e-4705-a994-f7c326967bnn and send XML code in body data of HTTP request, but it fails with response
500 (Invalid Security Header)
So, my question is - is it possible, to randomize UUID in uploading XML file or how can I make it?
Invalid Security Header message indicates that the contents of your wsse:Security header is malformed.
Without seeing the header itself it's hard to say what's wrong exactly, most probably you're sending a hard-coded timestamp which in the past hence server doesn't accept it. Also it could be that the signature is required and again your hard-coded signature is not accepted.
I would recommend installing WS Security for SOAP plugin using JMeter Plugins Manager
and once you perform the necessary configuration it should generate the "good" header so your SOAP request will be accepted.
I wanted to use vs code's extension REST client for testing purposes. So I used a curl of an existing API running on my local machine. But instead of JSON, I got HTML as a response. The curl works as expected in the terminal but not with the extension.
The same Behaviour is with another extension named Thunder Client.
Postman is getting JSON responses for the same API I believe that issue lies within vs code itself, I just don't know how to resolve it.
According to this article:
https://softwareengineering.stackexchange.com/questions/207835/is-it-ok-to-return-html-from-a-json-api
If you have declared you only accept one format in the header then the service should only send back that format or throw an error. If you have not put an ACCEPT in the header, the the service may send back whatever.
Check what is in the ACCEPT header:
But also check how Thunder Client translates the call in powershell:
I see that in my call the response is translated to JSON. I would guess that most REST clients are assuming that users want to work in JSON. Maybe that's what your two REST clients are doing?
I'm trying to replicate a post request done normally by a website form via postman but the server returns 500 error.
the form website URL that I'm dealing with is here.
what I have done so far is investigate the network request using chrome or safari dev tools, copy the request as cURL, import the cURL in postman and do the request.
what can be the possible reasons for the failure and what are the alternative ways to achieve the same result?
Postman Headers:
Most probably you must have used invalid request body. The browser shows parsed json body and you might have copied incomple request body.
To get full body click view source and copy the full content.
I'm just getting started with Cloudinary, and I'm attempting to Uploading with a direct call to the API. Using the DHC REST Client (chrome extension), I put my request together per the instructions found here at Creating API authentication signatures. Here's a screenshot of that request and response.
I also tried...
adding quotes around all values except timestamp as shown in the example
making the request a multi-part request and attaching the image to the body as a "file"
deleting timestamp, api_key, and signature and instead replacing them with upload_preset to try and upload an unsigned image (yes, I created the preset)
And finally, I did try adding public_id even though it says it would assign one if not provided.
In all cases, I get the same error response... Missing required parameter - file
Can anyone tell me what I'm missing?
Ok, figured it out. These name/value pairs need to be added to the body of the request rather than the header. Here's what that would look like in the DHC client. Note that the upload_preset will not work for you... I only created it to test with. Also note that doing a signed request is accomplished the same way but with different parameters.