Paw - How do I disable Content-Type header? - paw-app

I'm testing an API that won't work if Content-Type HTTP header is provided, the request look like this:
# this works
curl -X "POST" "https://example.com" \
-d "text=text content"
If I create this request in Paw, Content-Type is automatically added and the request becomes
# this doesn't work for this API
curl -X "POST" "https://example.com" \
-H 'Content-Type: text/plain; charset=utf-8' \
-d "text=text content"
So how do I disable the Content-Type header? Setting it with an empty value doesn't work either.

Paw has an "Automatically Send Content-Type Header" option under Preferences -> Network.

Related

How do I manually POST JSON data with only an ssh connection (no cURL or other utility)

I want to manually POST JSON data using just a keyboard and ssh connection (i.e. without cURL). The cURL functionality I'm trying to replicate which works great is equivalent to:
curl -s -w '\n' -X POST -D - \
-H "Content-type: application/json" \
-d '{"param1":"value1","param2":"value2"}' \
https:///myserver.com/mypath
However, when I connect manually:
openssl s_client -connect myserver.com:443 -quiet
and then enter
POST /mypath HTTP/1.1
Host: myserver.com
Content-type: application/json
Accept: application/json
{
"param1": "value1",
"param2": "value2"
}
I get the message "Json content error HV000116: The object to be validated must not be null." I've tried every variation I can think of with whitespace, and encoding, but I still get the error. I know I'm missing something simple, but what is it?
Doh! Just needed to add the Content-length header and everything worked

Generate a cURL request from a Postman

I tried generating a cURL request from Postman (using code option of postman).
As the request contains an input pdf file, there are certain header properties that are being added by postman.
Below is the curl that is generated (almost similar, changed some header for security reasons), response received 500, internal Server Error, "Current request is not a multipart request"
http://localhost:8080/test \
-H 'Accept: application/json' \
-H 'Content-Type: application/x-www-form-urlencoded,multipart/form-data; boundary=--------------------------895926775956600620357522' \
-H 'Some-Key: abcd' \
-H 'cache-control: no-cache' \
-F file=#/C:/path/to/my/file/abc.pdf
If you want to send the multipart request in Postman, you just need to do the following:
Don't specify a Content-Type in Header.
In Body tab of Postman you should select form-data and select file type
Read more here.

What does -d stand for in curl request?

I am trying to send this HTTP request in Postman application:
curl -v https://api.someurl.com/z1/lists \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: authorization" \
-d '{ "list_id": "DXVBDAD" }'
Any body knows what -d stands for? and where should I put it in Postman?
The documentation says this:
(HTTP) Sends the specified data in a POST request to the HTTP server[...]
So this will be the body of your POST request. In Postman you have to put it into the 'body' field. There select 'raw' and then select 'application/json'.
Because that's the Content-Type of your request, specified with -H.
The -d or --data option makes the curl command send data in POST request to the server. This option makes the curl command pass data to the server using content-type (JSON in your case) just as the browser does when a user submits a form.

Activate KAA configuration using Server REST APIs

I used kaa rest api for activate my configuration (using Postman), but i have no idea how to fill Parameter content type of configurationId . I have try
{
"id" : "98593",
"applicationId": "32769",
"schemaId": "65544" ,
"endpointGroupId": "98308"}
but I get HTTP/1.1 400 Bad Request, any suggestion will be appreciated.
Thanks
finally i can solve this problem,
You need to set your content-type to application/json and POST body just fill with configuration id
curl -v -S -u username:password -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '12423' 'http://localhost:8080/kaaAdmin/rest/api/activateConfiguration' | python -mjson.tool

Pass SSOTokenID as set-cookie value in OpenAM

I'm using openam OAuth/OpenID for user authentication. As mentioned in the documentations, I could get SSOTokenID as a JSON object by making following HTTP request.
curl -X POST -H "X-OpenAM-Username: demo" -H "X-OpenAM-Password: changeit" -H "Content-Type: application/json" -d '' -k -v https://openam.example.com:8443/openam/json/authenticate?realm=/
Instead of that, I want to get SSOTokenID as the Set-Cookie header value of the HTTP response. Are there anyway that i can do it?
Assuming you are only using an authentication module that accepts a NameCallback and PasswordCallback (as you used in your example), then you can just use the legacy UI zero-page login , you need to disable XUI though
Using your example
curl -X POST -d 'IDToken1=demo&IDToken2=changeit' -k -v https://openam.example.com:8443/openam/UI/Login?realm=/

Resources