curl no URL specified using POST

mutanthumb picture mutanthumb · Apr 16, 2017 · Viewed 8.7k times · Source

From a shell, I'm trying to use the REST API for Fedora Commons to upload a binary to a particular location using curl:

curl -X PUT --upload-file image.jpg -H "Content-Type: image/jpeg" -H "http://localhost:8080/rest/TestUpload/newexcel"

The error I'm getting:

curl: no URL specified!

Following instructions from here: https://wiki.duraspace.org/display/FEDORA471/RESTful+HTTP+API

Answer

Dan Cantir picture Dan Cantir · Apr 16, 2017

-H is for extra header to include in the request when sending HTTP to a server and you should not use it before the url.

You probably need to do curl -X PUT --upload-file image.jpg -H "Content-Type: image/jpeg" http://localhost:8080/rest/TestUpload/newexcel