Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • -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
Info
titleCreating New Objects

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

Sample FOXML file

Code Block
languagehtml/xml
titlecurl-ingest-demo_1-foxml.xml
<?xml version="1.0" encoding="UTF-8"?>
<foxml:digitalObject VERSION="1.1" PID="curl-ingest-demo:1"
    xmlns:foxml="info:fedora/fedora-system:def/foxml#"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
    <foxml:objectProperties>
        <foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
    </foxml:objectProperties>
    <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="http://www.openarchives.org/OAI/2.0/oai_dc/">
            <foxml:xmlContent>
                <oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
                    xmlns:dc="http://purl.org/dc/elements/1.1/"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
                    <dc:identifier>curl-ingest-demo:1</dc:identifier>
                    <dc:title>An object ingested by posting a FOXML document to the REST API using CURL.</dc:title>
                </oai_dc:dc>
            </foxml:xmlContent>
        </foxml:datastreamVersion>
    </foxml:datastream>
</foxml:digitalObject>