Skip to main content
← Data, API & Backend
Data, API & Backend November 11, 2022 · 7 replies

400 Bad Request

Archived from the Bravo community forum (2021–2026). Some answers may refer to older versions of Bravo.

I'm getting a 400 Bad Request Error when I attempt to do a POST Request. The input fields with the issue are integers and the error occurs setting variables without Quotation Marks. But adding quotation marks will give me a 422 error since the fields in Airtable is set as a number and not a string.
ex. ${TotalBags} as oppose to "${TotalBags}"
Can someone help?

 {
      "fields": {
        "Name": "${Name}",
        "Email": "${Email}",
        "Phone #": "${Phone}",
        "Date": "${Date}",
        "Time": "${Time}",
        "TotalBCs": ${TotalBCs},
        "TotalBags": ${TotalBags},
        "BagImages": [
          {
            "url": "${Photo}"
          }
        ],
        "PickupLocation": "${Location}"
      }
    }

7 replies

Valter November 12, 2022

Try this:
{
  "records": [
    {
      "id": "${id}",
      "fields": {
        "Name": "${Name}",
        "Email": "${Email}",
        "Phone #": "${Phone}",
        "Date": "${Date}",
        "Time": "${Time}",
        "TotalBCs": "${TotalBCs}",
        "TotalBags": "${TotalBags}",
        "BagImages": [{"url": "${Photo}"}],
        "PickupLocation": "${Location}"
      }
    }
  ],"typecast": true
}

Valter November 12, 2022

Do you have sure that this is right?
 "BagImages": [{"url": "${Photo}"}],

Valter November 12, 2022

if the error persist, remove this line and try again.
 "BagImages": [{"url": "${Photo}"}],

Rudy November 12, 2022

I still get an error

{
  "error": {
    "type": "INVALID_VALUE_FOR_COLUMN",
    "message": "Field \"TotalBCs\" cannot accept the provided value"
  }
}

Rudy November 12, 2022

"BagImages": [{"url": "${Photo}"}], is fine, this is not what is giving me the problem. The field that requires an integer is causing an issue.

Valter November 12, 2022

Dies the TotalBCs column on airtable is set to a # (number field) or a lookup, formula, or othe?

Rudy November 13, 2022

Hi Valter,

For some weird reason after recreating my table using "typecast": true
finally worked for me with no errors. Thanks for your help.

I'm not sure why this isn't in any of Bravo's help Document, but for those who are having issues creating POST Requests please read Airtable API Documentation. This is what I found after Valter's help:

"The Airtable API will perform best-effort automatic data conversion from string values if the typecast parameter is passed in (click to hide example). Automatic conversion is disabled by default to ensure data integrity, but it may be helpful for integrating with 3rd party data sources." - Airtable

Wrote something in this thread and want it removed? Request removal

Still stuck?

Ask the community on Discord

This archive is read-only. New questions, office hours and product updates now happen in the Bravo Discord.

Join the Discord