Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postman request with body Form data to json

I have a problem with postman...

For one side, I can make this request with the body in form data. enter image description here

But, when I try to send the same request with the body in raw(json) I got this:

enter image description here

I am trying to send the data via Angular 5 to a Drupal 8 Backend.

Thanks!

like image 995
ValRob Avatar asked Apr 05 '18 15:04

ValRob


People also ask

How can I pass form data as JSON in Postman?

POST request to send JSON in a form (multipart/form-data) By default, the content type of each part is not visible. You need to enable this by clicking the three dots and enabling Content Type. This will allow you to create a multipart/form-data request with each part having a different content type.


2 Answers

Try adding to the Headers the Content-Type: application/json

enter image description here

like image 150
Leandro Soriano Avatar answered Oct 18 '22 15:10

Leandro Soriano


It will depend if the backend can receive a JSON format.

In my case, I am working with the Drupal 8 Module simple Oauth. and the The format for OAuth 2.0 Bearer tokens is actually described in a separate spec, RFC 6750.

More concrete here

The entity-body follows the encoding requirements of the "application/x-www-form-urlencoded" content-type as defined by HTML 4.01 [W3C.REC-html401-19991224].

So, In my particular case, I will try to send a form-data from angular.

Thanks: Jean Rostan

like image 21
ValRob Avatar answered Oct 18 '22 13:10

ValRob