Loading TOC...

PUT /v1/config/transforms/{name}

Summary

Create or update the named transform.

URL Parameters
title? Title metadata for the transform. This free-form string is returned by GET /v1/config/transforms.
provider? Provider metadata for the transform. This free-form string is returned by GET /v1/config/transforms.
version? Version metadata for the transform. This free-form string is returned by GET /v1/config/transforms.
description? Description metadata for the transform. This free-form string is returned by GET /v1/config/transforms.
trans:{name}* The name, type, and cardinality of a transform-specific parameter. {name} is the parameter name. The parameter value is an XQuery SequenceType, including cardinality (*, ?, etc.) such as appears in the type declaration of an XQuery function parameter.
format? You can use this parameter as a fallback to the request Content-type header. The Content-type header takes precedence over format in most cases; for details, see Controlling Input and Output Content Type in the REST Application Developer's Guide. Accepted values: xslt, xquery, or javascript.
Request Headers
Content-Type The MIME type of the data in the request body, one of application/xslt+xml, application/xquery, or application/vnd.marklogic-javascript.

Response

Upon success, MarkLogic Server responds with status 204 (Transform Created).

Required Privileges

This operation requires the rest-admin role, or the following privileges:

http://marklogic.com/xdmp/privileges/rest-admin

http://marklogic.com/xdmp/privileges/rest-writer

http://marklogic.com/xdmp/privileges/rest-reader

Usage Notes

Once installed, the transform can be used with other MarkLogic REST API services that accept a transform parameter.

It is recommended that the request always include a Content-type header, even though it is not strictly required.

If the named transform is already installed, MarkLogic Server replaces the content and metadata with the new information from this request.

For more details, see Working With Content Transformations in the REST Application Developer's Guide.

Example

$ curl --anyauth --user user:password -X PUT -d@"./transform.xqy" -i \
    -H "Content-type: application/xquery" \
    'http://localhost:8004/v1/config/transforms/example?title=example transform'

==> Install an XQuery transform named "example" with the description 
    "example transform" and the implementation contained in transform.xqy.
    MarkLogic Server responds with headers of the form:

Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close

HTTP/1.1 204 Created
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 4
Connection: close
  

Example

# Note: Use --data-binary instead of -d with curl to preserve newlines
# in the input, such as line-oriented comments (//).

$ curl --anyauth --user user:password -X PUT -i \
    --data-binary @"./transform.sjs" \
    -H "Content-type: application/xquery" \
    'http://localhost:8004/v1/config/transforms/example?title=example transform'

==> Install a Server-Side Javascript transform named "example" with the 
    description "example transform" and the implementation contained in 
    transform.sjs. MarkLogic Server responds with headers of the form:

Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close

HTTP/1.1 204 Created
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 4
Connection: close
  

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy