Curl upload request issue

[root@localhost pamuser]# curl -v -u admin:admin --upload-file ${FILENAME} ${DESTINATION}

  • About to connect() to 1.1.1.1 port 8081 (#0)
  • Trying 1.1.1.1…
  • Connected to 1.1.1.1 (1.1.1.1) port 8081 (#0)
  • Server auth using Basic with user ‘admin’

PUT /repository/3.0.0-core/389-ds-base-devel-1.3.10.2-12.el7_9.x86_64.rpm HTTP/1.1
Authorization: Basic YWRtaW46a3IxMGlwc2xh
User-Agent: curl/7.29.0
Host: 10.20.42.52:8081
Accept: /
Content-Length: 1925
Expect: 100-continue

< HTTP/1.1 100 Continue

  • We are completely uploaded and fine
    < HTTP/1.1 400 Invalid RPM: 389-ds-base-devel-1.3.10.2-12.el7_9.x86_64.rpm
    < Server: Nexus/3.36.0-01 (OSS)
    < X-Content-Type-Options: nosniff
    < Content-Security-Policy: sandbox allow-forms allow-modals allow-popups allow-presentation allow-scripts allow-top-navigation
    < X-XSS-Protection: 1; mode=block
    < Content-Length: 0
    <
  • Connection #0 to host 1.1.1.1 left intact

I tried curl upload for my rpms but it is given this error.

Have you looked in the Nexus Repository logs to see if there’s any more information? Do you expect your RPM to be only 1925 bytes?

it has given 405 error.

admin [29/Nov/2021:14:32:17 +0300] “POST /service/extdirect/poll/rapture_State_get HTTP/1.1” 200 1394 77 5 “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36” [qtp864348718-437]

Error code 405 means that the HTTP method is not allowed at the resource you’re requesting.
The log line you posted shows that you are trying to use an internal API that is not meant to be used by users.
Please have a look at this article that shows how to upload a file to Nexus Repository 3.

@dsawa Is it possible to use the API for uploading directories with files/directories in them?

I finally did it, upload and download via curl multiple file folder etc.