When creating rows in batch on HubDB table, get "Invalid input JSON on line 1: values value"

Hi,

We get errors “Invalid input JSON on line1, column xxx: values value” where xxx is varying when trying to create rows in batch on an existing HubDB table.

Could you please shed some light?

Thanks,

Jing

Hi @jinglu

Code you are use has some errors, you follow this curl as given

curl --location ‘https://api.hubapi.com/cms/v3/hubdb/tables/**tableId**/rows/draft/batch/create’ \
--header ‘authorization: Bearer access_token’ \
--header ‘content-type: application/json’ \
--data ‘{
“inputs”: [
{
“values”: {
“name”: “Mayank”,
“age”: 32,
“gender”:“Male”
}
}, {
“values”: {
“name”: “Shubham”,
“age”: 32,
“gender”:“Male”
}
}
]
}’

In above curl

“name”: “Shubham”,

“age”: 32,

“gender”:“Male”

These are the column names with its values.

Results as shown in the screenshot

Hope this will helps you out. Please mark it as Solution Accepted & Upvote to help other Community member.
Thanks!

Hi @jinglu,

There is likely an issue in the body of your request. Can you please share an example of your request body so I can help further. Below is a very basic example of how you can use the HubDB endpoint to create rows in batch:

POST https://api.hubapi.com/cms/v3/hubdb/tables/5155793/rows/draft/batch/create
BODY
{
 "inputs": [
 {
 "values": {
 "name": "Peter Parker"
 }
 },
 {
 "values": {
 "name": "Bruce Banner"
 }
 }
 ]
}
RESPONSE
{
 "status": "COMPLETE",
 "results": [
 {
 "id": "77155012334",
 "createdAt": "2023-08-19T10:51:42.624Z",
 "updatedAt": "2023-08-19T10:51:42.624Z",
 "publishedAt": null,
 "values": {
 "name": "Bruce Banner"
 },
 "path": null,
 "name": null,
 "isSoftEditable": false,
 "childTableId": "0"
 },
 {
 "id": "77155012333",
 "createdAt": "2023-08-19T10:51:42.624Z",
 "updatedAt": "2023-08-19T10:51:42.624Z",
 "publishedAt": null,
 "values": {
 "name": "Peter Parker"
 },
 "path": null,
 "name": null,
 "isSoftEditable": false,
 "childTableId": "0"
 }
 ],
 "startedAt": "2023-08-19T10:51:42.620Z",
 "completedAt": "2023-08-19T10:51:42.638Z"
}

Resulting in:

Again, if you are able to share more specifics with regards the request you are making, particularly the request body I should be able to point you in the right direction in terms of fixing your issues. :blush:

GRajput and Gaurav,

Thanks for reply. Will provide more details once error shows up again. We tried in Postman first and everything looked good. Errors come up when creating rows in batch in a script running at intervals.

Jing

Hi, GRajput and Gaurav

It turns out that HubDB doesn’t accept value of None for some field. Once we replace None with empty string, everything works beautifully.

Thanks,

Jing