You are viewing limited content. For full access, please sign in.

Question

Question

HTTP Form Post

asked on July 29, 2021

Confused as to why the post request works using the Http Web Request but not with the HTTP Form POST.

When I try to do this it fails.

0 0

Answer

SELECTED ANSWER
replied on July 29, 2021 Show version history

It looks like it is failing because the API is expecting JSON content. Note how Web Request is sending "application/json" and a Form Post is multipart/form-data.

The error message says "Failed to decode JSON object" which suggests it wants application/json content, rather than the multipart/form-data sent in a form submission.

Is there a reason you want to use Form Post? Basically, that is only useful for posting data to a form (i.e., a web form with named input elements), not APIs that expect JSON, XML, etc.

Oversimplifying a bit, but a Form Post is basically like a user submitting an HTML form object in a browser and that's not what most APIs usually expect.

UPDATE: What Brian said lol

2 0

Replies

replied on July 29, 2021

The response message suggests that the service you are dealing with expects the payload to be json-formatted text, and not the multi-part format that the form post sends.

3 0
You are not allowed to follow up in this post.

Sign in to reply to this post.