APIs & Integrations

88atwilliams
Member

HubDB not updating

I created a table in HubDB for our products. This code below will get items in the database and display them. But, when we add a new row to our table. No new data is coming through.

//Init API - see HubSpot API docs for more info
fetch('https://api.hubapi.com/hubdb/api/v1/tables***/rows?portalId=****')
.then(function (response) {
return response.json();
})
.then(function (myJson) {
//Set URL param
var pathArray = window.location.pathname.split('/');
var composerUrl = pathArray[2]
console.log(composerUrl)

    //Get Raw Data from API
    var info = (JSON.stringify(myJson, null, 2));
    var obj = JSON.parse(info)
    
    //Get all objects from API
    for (i = 0; i < obj.objects.length; i++) {
    console.log(obj.objects[i].values[7])

    // Filter Objects by URL param
    if (composerUrl === obj.objects[i].values[7]){
    //log value of song title

// console.log(obj.objects[i].values[4])
//log value of href link
// console.log(obj.objects[i].values[10])
//sort attempt 100
var songs = [obj.objects[i].values[4]].sort()
// console.log(songs)
//Post href and song title to products id
document.getElementById("products").innerHTML += "

  • " + songs + "
  • "}
    }
    })
    0 Upvotes
    5 Replies 5
    88atwilliams
    Member

    HubDB not updating

    We just figured it out. The api request is limited at 1000. Our new entries took our request over 1000. :man_facepalming:

    0 Upvotes
    Dadams
    HubSpot Employee
    HubSpot Employee

    HubDB not updating

    @88atwilliams glad to hear that you got it sorted out.

    When you mention the 1000 limit, are you referring to what you get from the GET rows endpoint? Or for an update? Were you getting an error for anything or just missing the total field from the GET response?

    0 Upvotes
    88atwilliams
    Member

    HubDB not updating

    I was referring to the GET rows endpoint. No, errors on my end.

    0 Upvotes
    Dadams
    HubSpot Employee
    HubSpot Employee

    HubDB not updating

    Hi @88atwilliams

    Are the changes appearing when viewing the table inside HubSpot? Or are the changes showing up eventually? HubDb data does have some caching built into it, so if you're adding data and then immediately (as in within a few milliseconds) looking at the data you may not see the changes that quickly.

    0 Upvotes
    88atwilliams
    Member

    HubDB not updating

    Changes are not showing up at all. We are only getting data from the original DB.

    0 Upvotes