Insert data directly from JSON to HubDB

Hello,

We are looking into creating our product catalogue in HubDB based on our JSON table provided from an API.

I need to give a briefing to our developpers team about the way of integrating this data but I am lacking info.

We would like to be able to import the data directly from JSON to HubDB but I didn’t find any confirmation that it can be possible.

I know it’s possible to first transform it into a CSV file and then import to HubDB but we wouldn’t like to have to create a file and store it somewhere.

Is there any possiblity to directly stream the data from JSON to HubDB? If yes, is there any documentation about it?

Thanks a lot, HubSpot community :hugs:

Hi @MTarnopolska,

When using the HubDB API, you can only import, aka the “/cms/v3/hubdb/tables/{tableIdOrName}/draft/import” endpoint, via CSV. You are still able to add multiple rows via API using JSON by the “/cms/v3/hubdb/tables/{tableIdOrName}/rows/draft/batch/create” endpoint which batch creates rows. That enpoint expects JSON to be sent in with the following format:

{
 "inputs": [
 {
 "values": {
 "text_column": "sample text value",
 "number_column": 76,
 "multiselect": [
 {
 "id": "1",
 "name": "Option 1",
 "type": "option",
 "order": 0
 },
 {
 "id": "2",
 "name": "Option 2",
 "type": "option",
 "order": 1
 }
 ]
 },
 "path": "test_path",
 "name": "test_title",
 "childTableId": "1902373"
 }
 ]
}

Many of those fields above are optional, you can refer to the documentation to more information about the specific JSON format that endpoint is expecting.

Best,