APIs & Integrations

Uther
メンバー

[HUBDB API] Get foreignid value instead of id

解決

Hi,

 

i need to get the value from my foreignids, right now the HudDB API only returns the id and type field, if the field is foreign.

 

Is there a way to get the value from foreign fields?

Talking about this endpoint: "https://api.hubapi.com/hubdb/api/v2/tables/*/rows?portalId=*"

 

BR

0 いいね!
2件の承認済みベストアンサー
ben-duchy
解決策
トップ投稿者

[HUBDB API] Get foreignid value instead of id

解決
0 いいね!
Uther
解決策
メンバー

[HUBDB API] Get foreignid value instead of id

解決

Hey, 

 

i found a solution which involes another api call:

/cms/v3/hubdb/tables/{tableIdOrName}

 

This Endpoint returns the details of the published table and with the parameter 

includeForeignIds

all foreign ID values will be populated.

 

So we can fetch the table details and get all of the foreign id values, after that we fetch all of our rows that we need and map the foregin ids with the values we received.

 

BR

元の投稿で解決策を見る

8件の返信
ben-duchy
トップ投稿者

[HUBDB API] Get foreignid value instead of id

解決

Hi @Uther,

 

Your link is not working so I'm unsure if this is what you're looking for.

 

When creating bespoke web modules that require 2 HubDB tables, this may help you...

 

{% set example = hubdb_table_rows(1234567) %}
{% for row in example %}

  <!-- Step 1: Setup foreign ID column in your main HubDB table and link in HubL -->
  {% for foreign_row in row.bridge %}
 
    <!-- Step 2: Specify the foreign column that you want to lift -->
    {{ foreign_row["column_name"] }} -->

  {% endfor %}

{% endfor %}

 

Hope that helps

 

Ben

0 いいね!
Uther
メンバー

[HUBDB API] Get foreignid value instead of id

解決

Hi @BEN ,

 

the link was just an example of the api endpoint. i dont want to expose the portalId or the tableId here. 

 

I also cant use HubL and need to use the HubSpot API.

0 いいね!
ben-duchy
解決策
トップ投稿者

[HUBDB API] Get foreignid value instead of id

解決
0 いいね!
Uther
メンバー

[HUBDB API] Get foreignid value instead of id

解決

Its not exactly what i meant, i dont want to create foreign ids. I just want to receive the data from an HubDB Table. The rows dont display foreign values with thier value, instead they display the id of the value in the referenced table. My question was, if it is possible to receive the value with the same api call. 

0 いいね!
ben-duchy
トップ投稿者

[HUBDB API] Get foreignid value instead of id

解決

As I'm not familar with this, are you able to share the code you have (hiding the table / key information) ? It may help others to have a crack at it too.

0 いいね!
Uther
解決策
メンバー

[HUBDB API] Get foreignid value instead of id

解決

Hey, 

 

i found a solution which involes another api call:

/cms/v3/hubdb/tables/{tableIdOrName}

 

This Endpoint returns the details of the published table and with the parameter 

includeForeignIds

all foreign ID values will be populated.

 

So we can fetch the table details and get all of the foreign id values, after that we fetch all of our rows that we need and map the foregin ids with the values we received.

 

BR

ben-duchy
トップ投稿者

[HUBDB API] Get foreignid value instead of id

解決

Excellent 👍

0 いいね!
Jaycee_Lewis
コミュニティーマネージャー
コミュニティーマネージャー

[HUBDB API] Get foreignid value instead of id

解決

Hi, @Uther 👋 Thanks for reaching out. Hey, @ben-duchy @BarryGrennan @Gonzalo, do you have any experience here? Thank you! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 いいね!