api file upload fail

1. Accounts Dashboard | HubSpot

2.https://legacydocs.hubspot.com/docs/methods/files/v3/upload_new_filehttps://legacydocs.hubspot.com/docs/methods/files/v3/upload_new_file

upload file api

$file_options = array( “access” => “PUBLIC_INDEXABLE”, “overwrite” => false, “duplicateValidationStrategy” => “NONE”, “duplicateValidationScope” => “ENTIRE_PORTAL” );

$post_data = array( “file” => $upload_file, “options” => json_encode($file_options), “folderPath” => “/docs” );

when use folderPath whith ‘/docs’ just can upload once,

uploaded more than once, then get the error “message”:“A folder already exists at this path” ,so why?

Also if I specify folderId “folderId” => “166611224454”, get another error

{“status”:“error”,“message”:“internal error”,“correlationId”:“fc588f00-bca0-4ccd-a082-c471bf46aa13”}

or it will upload to the root path ‘/’


/filemanager/api/v3/files/upload
filePath: /docs

error: A folder already exists at this path

@HHdgjk - interesting issue! One thing I don’t see here is a setting for the target file name. My interface - in Python - includes this spec in the API call as follows:

files_data = {

‘fileName’ : file_name,

‘folderPath’ : folder_name,

‘file’: file_string,

‘charsetHunch’: ‘application/pdf’,

‘options’: json.dumps(file_options)

}

Overall this seems to me like ithis API call could definitely do with better documentation and examples!

Steve

However, the filename is not required - Accounts Dashboard | HubSpot

The essence of this problem is that the folders are duplicated. I don’t know why I can’t upload files to the same folder.

See examples from hubspot website, no fileName field