I'm trying to log into a website and using Postman to work out the POST.
The url is https://vaxmgmt.force.com/authorizedEnroller/s/login/?ec=302&startURL=%2FauthorizedEnroller%2Fs%2F
The html for the username and password are:
And the submit button:
I have in the headers "Content-Type" "application/json"
In the body/raw I have {"username":"username","password":"password"}
with a valid username and password
The headers that come back are:
Then I get "Invalid request, post must use JSON"
I'm just not sure where to go from here.
Did you select JSON as body type? It's on the right from radiobuttons with "none", "form-data", "raw"... and then a dropdown that has JSON as an option.
like here
p.s. Also, you said you used "Content-Type" "application/jason" - are you sure you didn't make a typo in json here? Please double check that just in case :)
Related
So, this is what I am working on UiPath..I have slack webhook.. I am POSTing using that webhook.. I have a variable "body" which is of type string.. I want to send that to slack using webhook..
In the body field, I used
"{""text"":"""+body+"""}"
And I checked the status code, it was 400..
And BodyFormat is 'application/json'
I sent a normal text without any concatenation, it worked fine..
the body looks okay to me in how you have it.
You mentioned using POST method, but I'd double check that utilising the "PUT" method
Also check that your Accept Format is set to JSON rather than Any.
No need to change your BodyFormat as "application/json" is correct
I'm trying to access an API using Postman to get a response using basic authentication, but when I submit the data, it gives me the dreaded 400 error, which apparently indicates that some headers aren't set up properly.
Here's the API info:
Request
Endpoint: {loginUrl}
Data to submit: an email and a password
POST /login HTTP/1.1
Host: {baseUrl}
Accept: application/json
Content-Type: application/json
Content-Length: 68
{
"email": "{email}",
"password": "{password}"
}
And in response, I should get an encrypted token in form of JSON, instead I'm getting this error.
Here are the postman screenshots:
Am I missing something?
I also faced the same issue and i updated my postman header with the below image. And issue solved.
From the lack of details it's difficult to offer a specific answer but I can offer something that you can try - The Request data you posted in the question looks like you should be adding:
{
"email": "{email}",
"password": "{password}"
}
In the Body section of the request but your images don't show that you've added that to the Body on any request, you've added it as a Auth header instead, so remove that before trying again. I'm not sure of the need to add the Content-Length header as that will change for different username and password combinations in the payload or for the length of the response.
In case anyone finds this helpful, I ran into the same issue and the culprit turned out to be missing headers. I knew I needed the "Content-Type": "application/json" header, which I already had in place, but I didn't know that I was missing two other headers.
The solution for me was also adding the "Content-Length" and "Host" headers in Postman.
I see some others have questioned the need for the "Content-Length" header, but in my case, the minimum three needed were "Content-Type", "Content-Length", and "Host" or it would always fail.
I faced a similar issue. it got resolved when i called my placeholder as a tuple.
I am trying to use HTTP Post to post the data by passing following Header and Body part,
Body:
One image URL having file path. Type as 'File'
Metadata in JSON format. Type as 'Text'
Headers:
Content-type = multipart/form-data
Authorization = Bearer 5412
Here is the screenshot of complete request,
This is how I have setup the HTTP Post task in Pentaho,
I found related post here using REST Client but this also didn't help: Pentaho HTTP Post using JSON
Really appreciate your help.
I think the problem is that "Post a file" doesn't mean include a file in the request, but rather to get the entire request from that file.
I don't know the specifics of how the data should look in the Post request, but the rough approach should be:
Pass the filename field to a Calculator step with the operation "Load file content to binary" to get a binary type field (ex: myimage)
Base64 (or other) encode the data with a Javascript step like this:
var encString = new Packages.java.lang.String( Packages.org.apache.commons.codec.binary.Base64.encodeBase64( myimage ) );
Wrap it in some content-type string indicating the encoding
Include the field in your request.
There is a patch on https://jira.pentaho.com/browse/PDI-14743 to enable proper binary transfer instead of String when using Rest Client.
I'm trying to work with the Advanced REST Client of Google.
I installed the extension, and I can work with it.
Now I wanted to use a JSON-file as input for my payload.
The JSON-file looks as follows :
{"UserName":"", "UserPassword":"","SetDebug":true}
The Content-Type is set to application/json.
But when I try to send the request I get the following error:
{
"Message": "The request entity's media type 'multipart/form-data' is not supported for this resource."
}
What am I doing wrong? Can anyone help me?
The ARC seems to override your Content-Type selection sometimes, changing it to multipart-form-data. If you select Files for the body and pick a file, it shows a message saying:
The Content-Type header will finally be changed to "multipart/form-data" during the request.
When you submit the request, it does exactly that: changes the Content-Type header. You can confirm this by looking in the Request Headers part of the output display.
I don't know if there's any way to stop it doing this :(-
I am trying to crawl a ajax site using Scrapy, the url is http://www.target.com/p/bounty-select-a-size-white-paper-towels-12-mega-rolls/-/A-14920157#prodSlot=medium_1_2&term=bounty
My goal is to get the store id. I did that by checking all the XHR request in chrome developer tool and find the one with name ("v1?request_type=availability&key=.....") to be the one I want.
My questions are:
In developer tool, there is "Query string parameter" which seems to be the part after ? of the request url. There is also Request Payload section, which is a json.
So which one should I use to send to the server? If i need request payload, how can I send a json file?
when i send the whole url to get json:
https://api.target.com/available_to_promise_aggregator/v1?request_type=availability&key=q0jGNkIyuqUTYIlzZKoCfK6ugaNGSP8h
I get "Request method 'GET' not supported", so should I use POST instead or there is something wrong I did?
You must send the query string as part of the URL after a ?, as you guessed.
To include a JSON payload in a request, and send the request as a POST request, use the method and body parameters of the Request class.