Nexus REST API Upload to Raw repository upload empty files

Trying to upload files to a Raw repository in Nexus using the REST API.

https://help.sonatype.com/repomanager3/rest-and-integration-api/components-api

Taken from the Maven Examples, but changed to use Raw fields.

curl -v -u 'deployment:password' -X POST -F 'raw.directory=/config/test' -F 'raw.asset1=fileArchive.tar.gz' -F 'raw.asset1.filename=fileArchive.tar.gz' 'https://nexus.company.com:8443/service/rest/v1/components?repository=reponame'

Not sure what is wrong. The files are uploaded, but they are empty in Nexus.
Running Nexus OSS 3.21.1

While writing this I took a look at suggested existing topics.
There I found another way to upload to RAW.

This works.
curl -v -u 'deployment:password' --upload-file fileArchive.tar.gz 'https://nexus.company.com:8443/repository/reponame/config/test/fileArchive.tar.gz'

Perhaps this could have been told in the documentation for the REST API, with RAW Examples.

1 Like