Skip to end of metadata
Go to start of metadata
Fedora Repository 3 Documentation
Page not found

The cURL application is a command line program for getting or sending files using URL syntax.  It is a popular tool for making REST API calls to Fedora for quick tests, scripted interactions or other cases where a client library or interface is too cumbersome for the need at hand.  While powerful and robust, at times the specific command line parameters required to get the desired behavior from Fedora's REST API are elusive.

To ingest a new object into fedora using a FOXML file from the command line, the following set of parameters is appropriate.

curl -vv -u "username:password" -H "Content-type:text/xml" -d "format=info:fedora/fedora-system:FOXML-1.1" -X POST --upload-file curl-ingest-demo_1-foxml.xml http://localhost:8080/fedora/objects/new


  • -vv represents verbose output and while entirely optional may be educational
  • -u "username:password" is the username and password for a user in your Fedora repository that may ingest new objects
  • -H "Content-type:text/xml" specifies the content type for the posted content (in this case, the FOXML data)
  • -d "format=info:fedora/fedora-system:FOXML-1.1" causes the values provided (format) to be included in the POST data
  • -X POST causes the request to use the POST HTTP method
  • --upload-file curl-ingest-demo_1-foxml.xml specifies the FOXML file to be ingested
  • http://localhost:8008/fedora/objects/new the REST URL for creating new objects

Creating New Objects

To create new objects (to which datastreams may be added later) simply omit the "d" and "upload-file" arguments.

Sample FOXML file

<?xml version="1.0" encoding="UTF-8"?>
<foxml:digitalObject VERSION="1.1" PID="curl-ingest-demo:1"
        <foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
    <foxml:datastream ID="DC" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
        <foxml:datastreamVersion ID="DC1.0" LABEL="Dublin Core Record for this object"
            MIMETYPE="text/xml" FORMAT_URI="">
                <oai_dc:dc xmlns:oai_dc=""
                    <dc:title>An object ingested by posting a FOXML document to the REST API using CURL.</dc:title>

  • No labels