Dear Don,
I use the REST API with PHP and curl. In order to specify the mimetype, I
specify the full FOXML, including the mimetype.
This works for me.
static function makeContentDatastream($dsid, $controlgroup, $label,
$mimetype, $location) {
$xml = '<foxml:datastream ID="'.$dsid.'"
CONTROL_GROUP="'.$controlgroup.'" VERSIONABLE="true">';
$xml .= ' <foxml:datastreamVersion ID="'.$dsid.'.0"
MIMETYPE="'.$mimetype.'" LABEL="'.$label.'">';
$xml .= ' <foxml:contentLocation REF="'.$location.'"
TYPE="URL"/>';
$xml .= ' </foxml:datastreamVersion>';
$xml .= '</foxml:datastream>';
return $xml;
}
Best,
-Rudi
> ------------------------------
>
> Message: 2
> Date: Wed, 3 Mar 2010 13:49:44 -0500
> From: Don Gourley <[email protected]>
> Subject: [Fedora-commons-users] mimeType not working on add/modify
> Datastream REST API
> To: [email protected]
> Message-ID:
> <[email protected]>
> Content-Type: text/plain; charset=UTF-8
>
> When I add or modify a managed XML datastream using the REST API, I am
> unable to get the correct mime-type on the datastreamVersion. For
> example,
>
> curl -i -XPUT
> "https://example.com:8443/fedora/objects/demo:29/datastreams/dctst?mimeType=te
> xt/xml&controlGroup=M&dsLabel=Test+mimeType"
> --data-binary @dc.xml -k -u fedoraAdmin:******
>
> creates a datastreamVersion like this:
>
> <foxml:datastreamVersion ID="dctst.5" LABEL="Test mimeType"
> CREATED="2010-03-03T18:10:23.286Z"
> MIMETYPE="application/x-www-form-urlencoded">
> <foxml:contentLocation TYPE="INTERNAL_ID" REF="demo:29+dctst+dctst.5"/>
> </foxml:datastreamVersion>
>
> (I've tried it url-encoded with the mimeType=text%2Fxml also)
>
> I know that I can add -H "Content-Type: text/xml" to the cURL command
> and get the right mime-type in the datastreamVersion, but the problem
> is that I am trying to write client application using PHP and libcurl
> and adding a content-type request header doesn't work with that mix.
> And the mimeType parameter is supposed to override the request header
> anyway, or am I not using it correctly?
>
> I am trying to update a Fedora 3.1 repository.
>
> thanks,
> -Don
>
>
>
> ------------------------------
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Fedora-commons-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users