If a file already exists, how do you upload a newer version of a file? Posting and Putting are giving me a 400 error.
Make a POST to .../nodes/{node_id}/versions with the file parameter containing the file content, using the multipart/form-data content type. For example:
POST
.../nodes/{node_id}/versions
file
multipart/form-data
var file = ..., // from a file input element. for example formData = new FormData(); formData.append('file', file); $.ajax({ url: '.../api/v1/nodes/12345/versions', type: 'POST', data: formData, processData: false, contentType: false });
You will find the new version number in the response, is the upload succeeds. For example:
{ "id": 12345, "version_number": 2 }