How to upload file in documents module with rest api

Hi all,

I'm trying to upload a document file via Rest API with POST /<module>/:record/file/:field endopoint but nothing seems to happen and info response on curl call reply http code 0.

I have done a call to /rest/v11/Documents to create the record and after receiving the id I try to call  

rest/v11/Documents/4ce530a0-fbb3-11ec-b9c6-42010ac60064/file/filename passing post fields with these arguments
$file_arguments = array(
"format" => "sugar-html-json",
"delete_if_fails" => true,
"oauth_token" => $oauth_token,
);

if ((version_compare(PHP_VERSION, '5.5') >= 0)) {
// $file_arguments['filename'] = new CURLFile($path,$original_note->file_mime_type,$original_note->filename);
$file_arguments['filename'] = new CURLFile($path,$original_note->latest_revision_file_mime_type,$original_note->filename);
} else {
// $file_arguments['filename'] = '@'.$path;
$file_arguments['filename'] = '@'.$path;
}

I followed instruction based on notes attachment.

What's wrong with this code?
The second call doesn't log anything in apache access log: it seems like i'm using a wrong url but if I change from DOCUMENTS module to NOTES everything goes right.

Any help will be appreciated.

Thanks in advance.