Can't get ZFS file ID of a field via specific module record
I have a `fileupload` field on a custom module that I need to replace the file for but I don't know how to get the ZFS ID from the module record.
# Getting the current fileupload
- GET https://www.zohoapis.eu/crm/v7/<MODULE>/<ID>
# Response
{
data: [{
// fileupload field
Invoice_PDF: [{
id: <REDACTED>, // Numeric ID. Probably the ID of the linking module record
File_Id__s: <REDACTED>, // This is not the ZFS ID. It also contains both numbers and letters but is way shorter
- Created_Time__s: '2024-12-13T11:55:11+01:00',
- File_Name__s: '2022-12-01-Easyfairs-Supercube-01.jpeg',
- Modified_Time__s: '2024-12-13T11:55:11+01:00',
- Created_By__s: <REDACTED>,
- Size__s: 3323506,
- id: '11191000117833056',
- Owner__s: <REDACTED>,
- Modified_By__s: <REDACTED>,
}]
}]
}
# Trying to replace the fileupload values
- POST https://www.zohoapis.eu/crm/v7/<MODULE>/<ID>
# Body contents
{
data: [{
// fileupload field
Invoice_PDF: [
{ File_Id__s: myFile.zohoFS_ID },
{ id: myZohoModuleRecord.data.Invoice_PDF[0].id, _delete: null }, // Delete the previous link entry
]
}]
}
// This API call errors when I'm doing a delink + link for the same Zoho file.
In short: I have no way of knowing if the file is already linked, based on the data that Zoho gives me.
When handling files I have to handle these scenarios:
- Module record has no `Invoice_PDF` linked to it => POST /files and PUT /<MODULE>/<ID> // This works
- Module record has `Invoice_PDF` linked to it
- Is it the same PDF? Idk?
- Is it another? Why do the IDs in `File_Id__s` differ between POST /files and GET /<MODULE>/<ID>?