Forum Discussion

AngelRodriguez's avatar
AngelRodriguez
Qrew Assistant Captain
4 years ago

Quick Base RESTful API, Insert/Update record(s) question

I see that the max payload size for this API is 10 MB, but my question is, can attachments be added to a record via the "Insert/Update API"? I don't see anything in the documentation mentioning this can or can't be used to add attachments. I'm asking because I'm trying to create workaround to the Pipelines limitation where attachments cannot be passed with the Outlook channel, so I'm doing this with Power Automate.

I created a Power Automate flow where the flow is triggered when an email message comes into my inbox with an attachment. I'm then making an HTTP request forEach Attachment, where the message is being added to a table and passing the Message ID, attachment content and the Attachment Name. If I test and skip the attachment, the API does create a record with a status code of 200, but when I try to pass the attachment, I get a multi-status 207 code and the record is not created. The error reads "Can not find file attachment content for field with ID '6'." 6 being the field ID of the attachment field in my table. Here's the HTTP request I'm making in Power Automate:

Method: POST,
URI: https://api.quickbase.com/v1/records,

headers = { '
QB-Realm-Hostname': '[MY_REALM].quickbase.com', 'User-Agent': '{User-Agent}',
'Authorization': 'QB-USER-TOKEN [MY_QB_USER_TOKEN]',
'Content-Type': 'application/json' },
{
"to": "[MY_TABLE_ID]", "data": [
{
"6": { "value": "@{items('For_Each_Attachment')?['contentBytes']}" },
"8": { "value": "@{triggerOutputs()?['body/subject']}" },
"9": { "value": "@{triggerOutputs()?['body/id']}" },
"17": { "value": "@{items('For_Each_Attachment')?['name']}" } }
],
"fieldsToReturn": [ 6, 8, 9, 17 ]
}​

Like I said, this works fine in Power Automate when I don't include the attachment. It's when I include the attachment that I'm getting the error message from Quick Base. I get this when I test the POST request on the Quick Base RESTful API page and in Power Automate so I do know that this is a QB error I'm getting. Anyone else experience this as well? Maybe I'm missing something in the documentation. Thanks!



------------------------------
AR
------------------------------

2 Replies

  • Yes, attachments can be added and updated using the upsert endpoint but the "value" object for the field has a different shape than other data types.  Instead of:{ "6": { "value": base64EncodedFile }}​it expects:
    { "6": { "value": { "fileName": "filename.pdf", "data": base64EncodedFile } }​ }


    If you look at the file attachment section for the file type details (https://developer.quickbase.com/fieldInfo ) you'll find their example for the record create endpoint.



    ------------------------------
    Nathan Hawe
    ------------------------------
    • AngelRodriguez's avatar
      AngelRodriguez
      Qrew Assistant Captain
      Awesome, thank you! I completely missed that part of the documentation. That worked for me, too.

      ------------------------------
      AR
      ------------------------------