Hi, I am using the POST /v1/documents endpoint of the Client API on 8000, to ingest several documents in one multipart request. The section "Controlling Document Type" [1], in chapter "Reading and Writing Multiple Documents" in the REST Guide, says:
"You can create JSON, XML, Binary, and Text documents in a bulk write. The MIME type of the part Content-Type header determines the database document type." And indeed, if I create a multipart to create documents with the following URI, with the following Content-Type, then it works fine (it creates four documents, of type resp. text, XML, JSON and binary): - /test/file-text.xxx - text/plain - /test/file-xml.xxx - application/xml - /test/file-json.xxx - application/json - /test/file-bin.xxx - application/octet-stream But if I replace the URI to use the extension ".xqy" instead of ".xxx" (the latter not being in the MIME table), then it uses text for all of them. Like if the "extension" of the URI was used and took precedence if it is in the MIME table. I can provide code to reproduce the multipart invocation, but I think it would be rather noise here. The code below is to retrieve the type of each document created. Is it a documentation bug? Or a product bug? Or just something I did wrong? Regards, [1]https://docs.marklogic.com/guide/rest-dev/bulk#id_75274 declare function local:doc-type($uri as xs:string) { let $root := fn:doc($uri)/node() return if ( $root instance of text() ) then 'text' else if ( $root instance of element() ) then 'xml' else if ( $root instance of object-node() ) then 'json' else 'binary' }; ('/test/file-text.xqy', '/test/file-xml.xqy', '/test/file-json.xqy', '/test/file-bin.xqy', '/test/file-text.xxx', '/test/file-xml.xxx', '/test/file-json.xxx', '/test/file-bin.xxx') ! (. || ' - ' || local:doc-type(.)) Result is: /test/file-text.xqy - text /test/file-xml.xqy - text /test/file-json.xqy - text /test/file-bin.xqy - text /test/file-text.xxx - text /test/file-xml.xxx - xml /test/file-json.xxx - json /test/file-bin.xxx - binary -- Florent Georges H2O Consulting http://h2o.consulting/
_______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general