Skip to main content

Error in POST method, "Could not find field \\"fields\\" in the request body"


Hi,

I am getting an error when using POST via Postman. I am copying the example exactly from the API documentation and changing the authorization key.

I have tried changing the content type, modifying the fields, but nothing worked.

GET method is working.

Why is this?

11 replies

Forum|alt.badge.img+3
  • Participating Frequently
  • 586 replies
  • January 21, 2019

You have copied the entire curl request into your request body.
Hence the error "Could not find field “fields” in the request body ".

What you need to do to rectify the above issue, is to only add in everything after the -d flag.
(-d in curl is used to set the the post request’s body)

After that you should be all set. :slightly_smiling_face:

Cheers!


  • Author
  • Participating Frequently
  • 5 replies
  • January 21, 2019

I have tried this in the body:

“fields”: {
“Pharmacy”: “Test”,
“PID”: “18101”,
“Transaction”: “123231”
},

and I have also tried this:

-d ‘{
“fields”: {
“Pharmacy”: “Test”,
“PID”: “18101”,
“Transaction”: “123231”
},
“typecast”: true
}’

Still, I get the same response. Could you show me the modified body?


Forum|alt.badge.img+3
  • Participating Frequently
  • 586 replies
  • January 21, 2019
John_Agius wrote:

I have tried this in the body:

“fields”: {
“Pharmacy”: “Test”,
“PID”: “18101”,
“Transaction”: “123231”
},

and I have also tried this:

-d ‘{
“fields”: {
“Pharmacy”: “Test”,
“PID”: “18101”,
“Transaction”: “123231”
},
“typecast”: true
}’

Still, I get the same response. Could you show me the modified body?


Try this.

{
“fields”: {
“Pharmacy”: “Test”,
“PID”: “18101”,
“Transaction”: “123231”
},
“typecast”: true
}

(I removed the “-d” and the single quotes)


  • Author
  • Participating Frequently
  • 5 replies
  • January 21, 2019
Andrew_Johnson1 wrote:

Try this.

{
“fields”: {
“Pharmacy”: “Test”,
“PID”: “18101”,
“Transaction”: “123231”
},
“typecast”: true
}

(I removed the “-d” and the single quotes)


Still the same error.


Forum|alt.badge.img+3
  • Participating Frequently
  • 586 replies
  • January 21, 2019
John_Agius wrote:

Still the same error.


In the “Headers” tab on Postman add in Content-Type:application/json

(The “key” will be Content-Type and “value” will be application/json)


  • Author
  • Participating Frequently
  • 5 replies
  • January 21, 2019

Different error;

Could not get any response

There was an error connecting to URL

Why this might have happened:

  • The server couldn’t send a response:

Ensure that the backend is working properly

  • Self-signed SSL certificates are being blocked:

Fix this by turning off ‘SSL certificate verification’ in Settings > General

  • Proxy configured incorrectly

Ensure that proxy is configured correctly in Settings > Proxy

  • Request timeout:

Change request timeout in Settings > General


Forum|alt.badge.img+3
  • Participating Frequently
  • 586 replies
  • January 21, 2019
John_Agius wrote:

Different error;

Could not get any response

There was an error connecting to URL

Why this might have happened:

  • The server couldn’t send a response:

Ensure that the backend is working properly

  • Self-signed SSL certificates are being blocked:

Fix this by turning off ‘SSL certificate verification’ in Settings > General

  • Proxy configured incorrectly

Ensure that proxy is configured correctly in Settings > Proxy

  • Request timeout:

Change request timeout in Settings > General


Okay so that’s good, it means that the request body issue is sorted out now.

Could you try accessing it again a couple of times to verify it was not a temporary connection issue

Or else after that could you try accessing the API via the curl command.
It would help in understanding whether its an issue on Postman’s side or your computer’s firewall, proxy etc.

Edit:
Also make sure that there are no spaces the Content-Type:application/json header.
Could you please share a screenshot of your Headers tab on Postman.


  • Author
  • Participating Frequently
  • 5 replies
  • January 21, 2019

Tried apitester dot com instead of POSTMAN with the above configuration and got:

{“error”:{“type”:“INVALID_REQUEST_BODY”,“message”:“Could not parse request body”}}


  • Author
  • Participating Frequently
  • 5 replies
  • January 21, 2019


Forum|alt.badge.img+3
  • Participating Frequently
  • 586 replies
  • January 21, 2019
John_Agius wrote:


Very strange, I have used Postman successfully in the past to connect to Airtable’s API and also been successful in posting content to the Airtable API via Postman
Please try it via curl and post the result here, I think for some reason Postman and apitester are adding in some extra headers…not sure though.
(Use the same command given in your base’s API documentation)

The curl output should hopefully provide some more insight into what the issue is :slightly_smiling_face:

BTW your API key is visible in the screenshot that you have shared…you will want to blur that part out.


Forum|alt.badge.img
  • New Participant
  • 1 reply
  • July 15, 2024

Nobody solved this issue in 5 years? Nice.


Reply