APIs & Integrations

LRomier
Member

Linking an uploaded file in HubDB

SOLVE

Hi everyone,

 

I am trying to create a HubDB row with a previously uploaded file.

 

Unfortunately, the documentation (https://developers.hubspot.com/docs/guides/api/cms/hubdb#add-table-rows) contains many use cases except files.

 

This code snippet is working:

client.cms.hubdb.rowsApi.createTableRow("id", {
    values: {
        name: "Dave",
    }
});

 

However, when handling files, I have tried the following, and none of it is working:

// This one gives the error that string cannot be matched to HubDB.File
client.cms.hubdb.rowsApi.createTableRow("id", {
    values: {
        file: file.id,
    }
});

// This one also gives the error that string cannot be matched to HubDB.File
client.cms.hubdb.rowsApi.createTableRow("id", {
    values: {
        file: file.url,
    }
});

// This one gives the error that object cannot be matched to HubDB.File
client.cms.hubdb.rowsApi.createTableRow("id", {
    values: {
        file: {
            id: file.id
        },
    }
});

 

Can anyone please provide some help regarding linking the file.

The file.id and file.url is directly from Hubspot after uploading the file.

 

Thank you and best regards

0 Upvotes
1 Accepted solution
SteveHTM
Solution
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Linking an uploaded file in HubDB

SOLVE

@LRomier - I'm not sure I have the solution here, but as you probably know, uploaded files from forms and attchements to emails are treated in a somwhat special way by the Files API. It's worth checking that:

- You have the right API scopes switched on to access this sort of file - including 'forms-uploaded-files'

- That the files are not set to Private (which seems the default). The API gives you an unhelpful 404 error for files that are set this way.

 

Good luck!

 

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

0 Upvotes
1 Reply 1
SteveHTM
Solution
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Linking an uploaded file in HubDB

SOLVE

@LRomier - I'm not sure I have the solution here, but as you probably know, uploaded files from forms and attchements to emails are treated in a somwhat special way by the Files API. It's worth checking that:

- You have the right API scopes switched on to access this sort of file - including 'forms-uploaded-files'

- That the files are not set to Private (which seems the default). The API gives you an unhelpful 404 error for files that are set this way.

 

Good luck!

 

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
0 Upvotes