Set Attachment Filename with the Airtable API (PATCH)

  • 12 March 2022
  • 0 replies
  • 518 views

Userlevel 7
Badge +14

Set Attachment Filename with the Airtable API (PATCH)

 

PURPOSE

Use the Airtable API to make a PATCH Request that will set the filename for a new file in an Attachment type field.

 

PREP

  1. Get your Airtable API Key: https://support.airtable.com/hc/en-us/articles/219046777-How-do-I-get-my-API-key-
  2. Get your Airtable Base ID: https://support.airtable.com/hc/en-us/articles/4405741487383-Understanding-Airtable-IDs
  3. Get your Attachment type field name.
    1. NOTE: If you change the name of the Attachment field, then the Zap will break.

 

NOTES

  1. This can only be used to create new files in an Attachment type field.
    1. Cannot update existing Attachment file names.
  2. This will replace existing files in the Attachment field.
  3. Review help article with how to send files in Zaps: https://zapier.com/help/create/basics/send-files-in-zaps

 

CONFIG

  1. For the Action step App, use Webhooks: https://zapier.com/apps/webhook/help
  2. For the Action step Event, use the Custom Request option
  3. Set the Method to PATCH
  4. In the URL
    1. Replace [APP_ID] with your Base ID
    2. Replace [RECORD_ID] with your Record ID
  5. In the Data
    1. Replace [FILE_URL] with the file link or file object
    2. Replace [FILE_NAME] with the filename
  6. In the Headers
    1. Replace [API_KEY] with your API Key
  7. Leave all other fields set to their default values (these may be empty)

 

CODE

{
"fields": {
"Attachments": [{
"url": "[FILE_URL]",
"filename": "[FILE_NAME]"
}]
}
}

 

TEST

Make sure to test and verify the results.

 

TIP

Use an Formula field to extract the file name from attachments.

Article: https://support.airtable.com/hc/en-us/articles/360034853774-Extract-the-file-name-from-attachments


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.