The CMS Files API, which this endpoint is part of, is a REST API. Are you referring to a JavaScript example?
If so, something like this just worked for me:
var data = new FormData();
data.append("files", "/Users/my/file/location.jpg");
data.append("file_names", "My File Name");
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.open("POST", "https://api.hubapi.com/filemanager/api/v2/files?hapikey=my_key");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send(data);
Please let me know if I've misunderstood your request.
I have been trying to send a replace file content request from my server (Node JS). I want to update the content of a json file, but I am getting a 400 error: