"Error: body.records is missing"

I am trying to Post a new record to a Table but I keep getting this error:
“Error: body.records is missing”

I have copied and pasted an existing record so I do not believe there is any issues with bad data-types or formatting. Ran it thru a JSON validator as well. My request is below for review.

Thanks


POST /api/docs/dCTs9G9125gi/tables/Flights/records HTTP/1.1
Authorization: Bearer {{API_TOKEN_REMOVED_FOR_SECURITY}}
Content-Type: text/plain; charset=utf-8
Cookie: grist_sid_prod=s%3Ag-kG9QG5SsDqYxgivJDu1S38.Gx4RO40q8R3zjYrdoS3cLYXPBqXQicVv1%2FlYX%2BmnlJo
Host: docs.getgrist.com
Connection: close
User-Agent: RapidAPI/4.1.1 (Macintosh; OS X/12.4.0) GCDHTTPRequest
Content-Length: 628
{
  "records": [
    {
      "fields": {
        "Flt_Number": 1000,
        "Dep": "XXX",
        "Arr": "YYY",
        "Nose_Number": 125
      }
    }
  ]
}

Hi @Jason_Taylor, could you try setting Content-Type: application/json rather than text/plain? I see that our documentation doesn’t emphasize this settinng, sorry about that. I’ve made a note to improve that.

Ah. Worked! Thanks! Overall loving Grist but I will say the API documentation could be more thorough. Thanks!

Glad that worked! I hear you about the API documentation, and hope to fill some of the holes. We do also accept pull requests at GitHub - gristlabs/grist-help: Grist documentation and help center articles :wink:

1 Like