APIs & Integrations

DavidFJones
Mitglied | Platinum Partner
Mitglied | Platinum Partner

Adding Video, Child Table, and Foreign ID's to API Created HubDB Table

lösung

Hey everyone.

So I'm trying to create a new hubdb table, or row in an existing table using the following endpoints : https://legacydocs.hubspot.com/docs/methods/hubdb/v2/create_row
https://legacydocs.hubspot.com/docs/methods/hubdb/v2/create_table
and have noticed that neither of these docs mention anything about Video, child table, or foreign id inputs. 

Is this possible to do with the current api? If not has anyone found any sort of workaround for inputting these data types?

0 Upvotes
1 Akzeptierte Lösung
WendyGoh
Lösung
HubSpot Employee
HubSpot Employee

Adding Video, Child Table, and Foreign ID's to API Created HubDB Table

lösung

Hey @DavidFJones,

 

I was able to create a HubDB table with both the video and foreign id as the columns field type: 

 

Here's my code:

 

{
	"name": "Test Table via API",
	"columns": [{
			"name": "videotestapi",
			"label": "videotestapi",
			"id": 1,
			"foreignIdsById": {},
			"foreignIdsByName": {},
			"type": "VIDEO"
		},
		{
			"name": "fidapi",
			"label": "fidapi",
			"id": 2,
			"foreignTableId": 2612853,
			"foreignIds": [{
					"id": 27798116643,
					"name": "27798116643",
					"type": "foreignid"
				},
				{
					"id": 27798116644,
					"name": "27798116644",
					"type": "foreignid"
				},
				{
					"id": 27810438617,
					"name": "27810438617",
					"type": "foreignid"
				},
				{
					"id": 27810438621,
					"name": "27810438621",
					"type": "foreignid"
				}
			],
			"foreignIdsById": {
				"27798116643": {
					"id": 27798116643,
					"name": "27798116643",
					"type": "foreignid"
				},
				"27798116644": {
					"id": 27798116644,
					"name": "27798116644",
					"type": "foreignid"
				},
				"27810438621": {
					"id": 27810438621,
					"name": "27810438621",
					"type": "foreignid"
				},
				"27810438617": {
					"id": 27810438617,
					"name": "27810438617",
					"type": "foreignid"
				}
			},
			"foreignIdsByName": {
				"27810438617": {
					"id": 27810438617,
					"name": "27810438617",
					"type": "foreignid"
				},
				"27810438621": {
					"id": 27810438621,
					"name": "27810438621",
					"type": "foreignid"
				},
				"27798116644": {
					"id": 27798116644,
					"name": "27798116644",
					"type": "foreignid"
				},
				"27798116643": {
					"id": 27798116643,
					"name": "27798116643",
					"type": "foreignid"
				}
			},
			"type": "FOREIGN_ID"
		}
	]
}

I'd advise for you to create the foreign ids column on the UI for one time so that you can use the Get details for a specific table to retrieve all the foreign ids values. 

 

In regards to child table, I'm not seeing any field type named as child table. Am I missing something here? 

Lösung in ursprünglichem Beitrag anzeigen

0 Upvotes
3 Antworten
WendyGoh
Lösung
HubSpot Employee
HubSpot Employee

Adding Video, Child Table, and Foreign ID's to API Created HubDB Table

lösung

Hey @DavidFJones,

 

I was able to create a HubDB table with both the video and foreign id as the columns field type: 

 

Here's my code:

 

{
	"name": "Test Table via API",
	"columns": [{
			"name": "videotestapi",
			"label": "videotestapi",
			"id": 1,
			"foreignIdsById": {},
			"foreignIdsByName": {},
			"type": "VIDEO"
		},
		{
			"name": "fidapi",
			"label": "fidapi",
			"id": 2,
			"foreignTableId": 2612853,
			"foreignIds": [{
					"id": 27798116643,
					"name": "27798116643",
					"type": "foreignid"
				},
				{
					"id": 27798116644,
					"name": "27798116644",
					"type": "foreignid"
				},
				{
					"id": 27810438617,
					"name": "27810438617",
					"type": "foreignid"
				},
				{
					"id": 27810438621,
					"name": "27810438621",
					"type": "foreignid"
				}
			],
			"foreignIdsById": {
				"27798116643": {
					"id": 27798116643,
					"name": "27798116643",
					"type": "foreignid"
				},
				"27798116644": {
					"id": 27798116644,
					"name": "27798116644",
					"type": "foreignid"
				},
				"27810438621": {
					"id": 27810438621,
					"name": "27810438621",
					"type": "foreignid"
				},
				"27810438617": {
					"id": 27810438617,
					"name": "27810438617",
					"type": "foreignid"
				}
			},
			"foreignIdsByName": {
				"27810438617": {
					"id": 27810438617,
					"name": "27810438617",
					"type": "foreignid"
				},
				"27810438621": {
					"id": 27810438621,
					"name": "27810438621",
					"type": "foreignid"
				},
				"27798116644": {
					"id": 27798116644,
					"name": "27798116644",
					"type": "foreignid"
				},
				"27798116643": {
					"id": 27798116643,
					"name": "27798116643",
					"type": "foreignid"
				}
			},
			"type": "FOREIGN_ID"
		}
	]
}

I'd advise for you to create the foreign ids column on the UI for one time so that you can use the Get details for a specific table to retrieve all the foreign ids values. 

 

In regards to child table, I'm not seeing any field type named as child table. Am I missing something here? 

0 Upvotes
DavidFJones
Mitglied | Platinum Partner
Mitglied | Platinum Partner

Adding Video, Child Table, and Foreign ID's to API Created HubDB Table

lösung

Hey @WendyGoh ,

Sorry for the late response. This project got a bit away from me.

So the child table component I'm trying to add/update is for a multilevel dynamic template. I'm using these child table components 
child table 2.png

 

child table 1.png

 

Since when creating/updating a foreign ID the value you input is that rows id, so far I have tried using the table's id that I wish to be the child table.

The code has looked like this so far

{
        name: payload.hs_name,
        path: payload.path,
        child_table: payload.child_table,
}

The value of payload.child_table is the id of the table I am wishing to use. 

I have also tried swapping out the key "child_table" with "child", as well as moved this value into the "values" section of the api call, but still with no success

0 Upvotes
DavidFJones
Mitglied | Platinum Partner
Mitglied | Platinum Partner

Adding Video, Child Table, and Foreign ID's to API Created HubDB Table

lösung

Almost right after posting this I found the solution

childTableId: payload.child_table


The key I was looking for was childTableId

0 Upvotes