Hi, Florent: How did you set up the REST server? What MarkLogic version is it? Did you try to install and run the sample REST server and extensions in the samples/rest-5min-guide directory?
One issue with your sample extension is that the functions return elements instead of documents, so they will throw an error once you do solve the installation problem. But that's not likely to be the source of the 415 error. Erik Hennum ________________________________________ From: [email protected] [[email protected]] on behalf of Florent Georges [[email protected]] Sent: Saturday, October 04, 2014 8:02 AM To: MarkLogic Developer Discussion Subject: [MarkLogic Dev General] Extending the REST API Hi, I am trying to install an extension module to the REST API. After http://docs.marklogic.com/guide/rest-dev/extensions#id_59112, I send a PUT request to http://xxx:8003/v1/config/resources/first-extension (the content of the extension itself is at the end of this email). Then I receive the following error: 415 Unsupported Media Type <rapi:error xmlns:rapi="http://marklogic.com/rest-api"> <rapi:status-code>415</rapi:status-code> <rapi:status>Unsupported Media Type</rapi:status> <rapi:message-code>RESTAPI-INVALIDMIMETYPE</rapi:message-code> <rapi:message>RESTAPI-INVALIDMIMETYPE: (err:FOER0000) Invalid mime type: reason: mime type must be application/xquery or application/vnd.marklogic-xdmp</rapi:message> </rapi:error> As you can see on http://fgeorges.org/tmp/ml-rest-api-ext.png, the content type header is set to application/xquery (as mentioned in the error message, I also tried application/vnd.marklogic-xdmp, with no success). Any idea? Just in case, the body of the PUT is: xquery version "1.0-ml"; module namespace my = "http://marklogic.com/rest-api/resource/first-extension"; declare function my:get( $context as map:map, $params as map:map ) as document-node()* { <error>IMPLEMENT ME!</error> }; declare function my:put( $context as map:map, $params as map:map, $input as document-node()* ) as document-node()? { <error>IMPLEMENT ME!</error> }; declare function my:post( $context as map:map, $params as map:map, $input as document-node()* ) as document-node()* { <error>IMPLEMENT ME!</error> }; declare function my:delete( $context as map:map, $params as map:map ) as document-node()? { <error>IMPLEMENT ME!</error> }; Any idea? Regards, -- Florent Georges http://fgeorges.org/ http://h2oconsulting.be/ _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
