APIs & Integrations

ZLyons
Participant | Diamond Partner
Participant | Diamond Partner

Update HubDb row via API

SOLVE

Hello dev community!

I am attempting to update a HubDb table row and receiving errors.
I'm able to read and create rows using my API key, but receive errors using the update/delete endoints.

I have included hubdb in my private app scope and read through the hubdb docs multiple times to sanity check but cannot find my mistake.

Does anyone have any idea why I can read/create rows but not update/delete rows? 

// You can see the error response below: 

ZLyons_0-1736370170436.png

// See request body:

ZLyons_1-1736370242816.png

// Source code for posterity

ZLyons_2-1736370574386.png


I appreciate your insight, I'm puzzled!
Zack

0 Upvotes
2 Accepted solutions
SteveHTM
Solution
Key Advisor | Partner
Key Advisor | Partner

Update HubDb row via API

SOLVE

@ZLyons - The only issue I can see is tha the API call URL should end with '/draft'

 

I hope it's that simple!

 

Steve

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature

View solution in original post

zach_threadint
Solution
Guide

Update HubDb row via API

SOLVE

Hi @ZLyons 👋

 

I agree with @SteveHTM. You'll need to use the "Updates an existing row" endpoint, then (if required) publish those changes using the "Publish a table from draft" endpoint. For example:

 

Update HubDB table row (i.e. draft change)

 

curl --location --request PATCH 'https://api.hubapi.com/cms/v3/hubdb/tables/:TABLE_ID/rows/:ROW_ID/draft' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer pat-eu1-abc-xyz' \
--data '{
    "values": {
        "column_name": "example text"
    }
}'

 

 

Publish drafted changes

 

curl --location --request POST 'https://api.hubapi.com/cms/v3/hubdb/tables/:TABLE_ID/draft/publish' \
--header 'Authorization: Bearer pat-eu1-abc-xyz'

 

I hope that proves helpful. Please let me know if you have any follow-up questions.

All the best,

Zach

--

Zach Klein
HubSpot Integrations & App Developer
Meanjin / Brisbane, Australia



Say g'day


If my post helped answer your query, please consider marking it as a solution.


View solution in original post

4 Replies 4
ZLyons
Participant | Diamond Partner
Participant | Diamond Partner

Update HubDb row via API

SOLVE

Hi Steve, 
Thanks for the feedback! The live vs draft tables feature seems to have confused me, I had hoped to push to the live table and skip the /publish endpoint step, but it's not a big deal to push to the draft table and then do the extra step of publishing it.

I appreciate you taking time to check out my problem,
happy new year!

Zack

0 Upvotes
SteveHTM
Solution
Key Advisor | Partner
Key Advisor | Partner

Update HubDb row via API

SOLVE

@ZLyons - The only issue I can see is tha the API call URL should end with '/draft'

 

I hope it's that simple!

 

Steve

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature
zach_threadint
Solution
Guide

Update HubDb row via API

SOLVE

Hi @ZLyons 👋

 

I agree with @SteveHTM. You'll need to use the "Updates an existing row" endpoint, then (if required) publish those changes using the "Publish a table from draft" endpoint. For example:

 

Update HubDB table row (i.e. draft change)

 

curl --location --request PATCH 'https://api.hubapi.com/cms/v3/hubdb/tables/:TABLE_ID/rows/:ROW_ID/draft' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer pat-eu1-abc-xyz' \
--data '{
    "values": {
        "column_name": "example text"
    }
}'

 

 

Publish drafted changes

 

curl --location --request POST 'https://api.hubapi.com/cms/v3/hubdb/tables/:TABLE_ID/draft/publish' \
--header 'Authorization: Bearer pat-eu1-abc-xyz'

 

I hope that proves helpful. Please let me know if you have any follow-up questions.

All the best,

Zach

--

Zach Klein
HubSpot Integrations & App Developer
Meanjin / Brisbane, Australia



Say g'day


If my post helped answer your query, please consider marking it as a solution.


ZLyons
Participant | Diamond Partner
Participant | Diamond Partner

Update HubDb row via API

SOLVE

Hey Zach,

thank you for the help! I guess I got caught by the draft vs. live feature, I should be able to accomplish what I need to now!

I appreciate you helping me get unstuck, I was having fun learning about HubDb and the blocker was frustrating me, haha.

Hope you have a great new year,
another Zack