|
|
DELETE /v1/config/namespaces
|
|
 |
Summary:
Remove all installed namespace bindings.
|
Required Privilege:
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
|
Response:
MarkLogic Server responds with 204 (Content Deleted).
|
Usage Notes:
To remove a specific binding, use
DELETE /v1/config/namespaces/{prefix}.
For details, see 'Using Namespace Bindings' in the REST Application Developer's Guide.
|
Example:
$ curl --anyauth --user user:password -X DELETE -i \
http://localhost:8003/v1/config/namespaces
==> MarkLogic Server removes all namespace bindings for the REST
service on port 8003. MarkLogic Server returns the following headers:
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close
HTTP/1.1 204 Content Deleted
Server: MarkLogic
Content-Length: 0
Connection: close
|
|
|
|
GET /v1/config/namespaces
|
|
 |
Summary:
List all namespace bindings configured for use in queries,
ordered alphabetically by prefix.
|
Parameters:
format?
:
The format of the content returned by by the request, either
xml or json. The format parameter overrides
any format specified in the Accept header.
|
|
Request Headers:
Accept*:
The expected MIME type of the response, either
application/json or application/XML (the
default). If the format parameter is set, the Accept
header is ignored in favor of the format parameter.
|
|
Response Headers:
Content-Type:
The MIME type of the content returned in the response body, one of
application/xml or application/json,
depending on the type requested by the format value
or Accept header.
|
|
Required Privilege:
This operation requires the rest-reader role, or the
following privilege:
This operation requires the following privilege, available through the
pre-defined rest-reader role.
http://marklogic.com/xdmp/privileges/rest-reader
|
Response:
Upon success, MarkLogic Server returns status 200 (OK) and the
response body contains the requested information.
When requesting XML results, the response body contains data of the
following form for each namespace binding:
<namespace xmlns="http://marklogic.com/sdmp/group">
<prefix>the-prefix</prefix>
<namespace-uri>the-uri</namespace-uri>
</namespace>
When requesting JSON results, the response body contains data of the
following form for each namespace binding:
{ "prefix" : "the-prefix", "uri" : "the-uri" }
|
Usage Notes:
For details, see 'Using Namespace Bindings' in the REST Application Developer's Guide.
The expected response type can be specified using either the
format parameter or Accept header. One or
the other must be supplied. If both are supplied and are different,
the format parameter takes precedence.
|
Example:
$ curl --anyauth --user user:password -X GET -i \
http://localhost:8004/v1/config/namespaces?format=xml
==> MarkLogic server responds with a 200 status and the requested
namespace binding information as XML. For example, the following
data is returned for a single binding of the prefix "bill" to
http://makrlogic.com/examples/shakespeare:
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close
HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 225
Connection: close
<rapi:namespace-bindings xmlns:rapi="http://marklogic.com/rest-api">
<rapi:namespace>
<rapi:prefix>bill</rapi:prefix>
<rapi:uri>http://marklogic.com/examples/shakespeare</rapi:uri>
</rapi:namespace>
</rapi:namespace-bindings>
|
Example:
$ curl --anyauth --user user:password -X GET -i \
http://localhost:8004/v1/config/namespaces?format=json
==> MarkLogic server responds with a 200 status and the requested
namespace binding information as JSON. For example, the following
data is returned for a single binding of the prefix "bill" to
http://makrlogic.com/examples/shakespeare:
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close
HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 92
Connection: close
{"namespace-bindings":[
{
"prefix":"bill",
"uri":"http://marklogic.com/examples/shakespeare"
}
]}
|
|
|
|
POST /v1/config/namespaces
|
|
 |
Summary:
Create or append to namespace bindings that can be used in
subsequent query operations.
|
Parameters:
format?
:
The format of the content in the request body, either
xml or json. The format parameter
overrides any format specified in the Accept header.
|
|
Request Headers:
Content-Type?:
The MIME type of the data in the request body, either
application/xml or application/json.
Ignored if a format parameter is present.
|
|
Required Privilege:
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
|
Response:
Upon success, MarkLogic Server responds with a status 201 (Content
Created). MarkLogic Server responds with a status 400 (Bad Request)
if the request contains a bad binding or attempts to replace an
existing binding with a new value.
|
Usage Notes:
For details, see 'Using Namespace Bindings' in the REST Application Developer's Guide.
This method appends to existing namespace bindings. To replace a
binding, use the PUT method.
The content type can be specified using either the
format parameter or Content-type header. One
or the other must be supplied. If both are supplied and are different,
the format parameter takes precedence.
If a binding already exists for the prefix and this request does not
bind the prefix to the same namespace URI, MarkLogic server responds
with status 400 (Bad Request). To change the namespace associated with
prefix, use PUT /v1/config/namespaces/{prefix}.
The request body must have the following format when sending XML:
<rapi:namespace-bindings xmlns="http://marklogic.com/rest-api">
<rapi:prefix>the-prefix</rapi:prefix>
<rapi:uri>the-uri</rapi:uri>
</rapi:namespace-bindings>
The request body must have the following format when sending JSON:
{ "prefix" : "the-prefix", "uri" : "the-uri" }
|
Example:
$ cat ns-xml
<namespace-bindings xmlns="http://marklogic.com/rest-api">
<namespace>
<prefix>bill</prefix>
<uri>http://marklogic.com/examples/shakespeare</uri>
</namespace>
</namespace-bindings>
$ curl --anyauth --user user:password -X POST -d@'./ns-xml' -i \
-H "Content-type: application/xml" \
http://localhost:8003/v1/config/namespaces
==> MarkLogic Server creates or appends the namespace binding between
the prefix "bill" and the namespace URI
"http://marklogic.com/examples/shakespeare. MarkLogic Server
returns the following headers:
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close
HTTP/1.1 201 Content Created
Location:
Server: MarkLogic
Content-Length: 0
Connection: close
|
Example:
$ cat ns-json
{
"namespace-bindings": [
{
"prefix": "will",
"uri": "http:\/\/marklogic.com\/examples\/shakespeare"
}
]
}
$ curl --anyauth --user user:password -X POST -d@'./ns-json' -i \
-H "Content-type: application/json" \
http://localhost:8003/v1/config/namespaces
==> MarkLogic Server creates or appends the namespace binding between
the prefix "will" and the namespace URI
"http://marklogic.com/examples/shakespeare. MarkLogic Server
returns the following headers.
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close
HTTP/1.1 201 Content Created
Location:
Server: MarkLogic
Content-Length: 0
Connection: close
|
|
|
|
PUT /v1/config/namespaces
|
|
 |
Summary:
Create or replace namespace bindings that can be used in subsequent
query operations.
|
Parameters:
format?
:
The format of the content in the request body, either
xml or json. The format parameter
overrides any format specified in the Accept header.
|
|
Request Headers:
Content-Type?:
The MIME type of the data in the request body, either
application/xml or application/json.
Ignored if a format parameter is present.
|
|
Required Privilege:
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
|
Response:
Upon success, MarkLogic Server responds with a status 204 (Content
Updated). MarkLogic Server responds with a status 400 (Bad Request)
if the request contains a bad binding.
|
Usage Notes:
Use this request for creating or replacing bindings. All existing
bindings are replaced by the bindings in the request body. To add
new bindings without changing existing bindings, use the POST method.
To replace only one binding, use
PUT /v1/config/namespaces/{prefix}.
For details, see 'Using Namespace Bindings' in the REST Application Developer's Guide.
The content type can be specified using either the format
parameter or Content-type header. One or the
other must be supplied. If both are supplied and are different,
the format parameter takes precedence.
The request body must have the following format when sending XML:
<rapi:namespace-bindings xmlns="http://marklogic.com/rest-api">
<rapi:prefix>the-prefix</rapi:prefix>
<rapi:uri>the-uri</rapi:uri>
</rapi:namespace-bindings>
The request body must have the following format when sending JSON:
{ "prefix" : "the-prefix", "uri" : "the-uri" }
|
Example:
$ cat ns-xml
<namespace-bindings xmlns="http://marklogic.com/rest-api">
<namespace>
<prefix>bill</prefix>
<uri>http://marklogic.com/examples/shakespeare</uri>
</namespace>
</namespace-bindings>
$ curl --anyauth --user user:password -X PUT -d@'./ns-xml' -i \
-H "Content-type: application/xml" \
http://localhost:8003/v1/config/namespaces
==> MarkLogic Server replaces any existing namespace bindings with the
single binding between the prefix "bill" and the namespace URI
"http://marklogic.com/examples/shakespeare. MarkLogic Server
returns the following headers.
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close
HTTP/1.1 204 Content Updated
Location:
Server: MarkLogic
Content-Length: 0
Connection: close
|
Example:
$ cat ns-json
{
"namespace-bindings": [
{
"prefix": "will",
"uri": "http:\/\/marklogic.com\/examples\/shakespeare"
}
]
}
$ curl --anyauth --user user:password -X PUT -d@'./ns-json' -i \
-H "Content-type: application/json" \
http://localhost:8003/v1/config/namespaces
==> MarkLogic Server replaces any existing namespace bindings with the
single binding between the prefix "will" and the namespace URI
"http://marklogic.com/examples/shakespeare. MarkLogic Server
returns the following headers.
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close
HTTP/1.1 204 Content Updated
Location:
Server: MarkLogic
Content-Length: 0
Connection: close
|
|
|
|
DELETE /v1/config/namespaces/{prefix}
|
|
 |
Summary:
Remove the namespace binding for {prefix}.
|
Required Privilege:
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
|
Response:
Upon success, MarkLogic Server responds with status 204 (Content
Deleted). MarkLogic Server responds with status 204 even if no
binding exists for {prefix}.
|
Usage Notes:
For details, see 'Using Namespace Bindings' in the REST Application Developer's Guide.
|
Example:
$ curl --anyauth --user user:password -X DELETE -i \
http://localhost:8004/v1/config/namespaces/bill
==> MarkLogic Server removes the namespace binding between the prefix
"bill" and the associated URI and responds with status 204.
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 Content Deleted
Server: MarkLogic
Content-Length: 0
Connection: close
|
|
|
|
GET /v1/config/namespaces/{prefix}
|
|
 |
Summary:
Retrieve the namespace URI associated with the REST service
namespace binding prefix {prefix}.
|
Parameters:
format?
:
The expected format of the response, either xml or
json. Overrides the format specified in the Accept header.
|
|
Request Headers:
Accept*:
The expected MIME type of the response, either
application/json or application/XML (the
default). If the format parameter is set, the Accept
header is ignored in favor of the format parameter.
|
|
Response Headers:
Content-Type:
The MIME type of the content returned in the response body, either
application/xml or application/json.
|
|
Required Privilege:
This operation requires the rest-reader role, or the
following privilege:
http://marklogic.com/xdmp/privileges/rest-reader
|
Response:
Upon success, MarkLogic Server returns status 200 and returns the
requested information in the response body, as either XML or JSON.
If no namespace binding exists for {prefix}, MarkLogic
server returns 404 (Not Found).
The response body has the following format when requesting XML:
<namespace xmlns="http://marklogic.com/rest-api">
<prefix>the-prefix</prefix>
<namespace-uri>the-uri</namespace-uri>
</namespace>
The response body has the following format when requesting JSON:
{ "prefix" : "the-prefix", "uri" : "the-uri" }
|
Usage Notes:
For details, see 'Using Namespace Bindings' in the REST Application Developer's Guide.
The expected response type can be specified using either the
format parameter or Accept header. One or
the other must be supplied. If both are supplied and are different,
the format parameter takes precedence.
|
Example:
$ curl --anyauth --user user:password -i \
-X GET http://localhost:8004/v1/config/namespaces/will?format=xml
==> MarkLogic Server responds with status 200 and returns the namespace
binding information for prefix "will", as XML. For example:
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close
HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 170
Connection: close
<rapi:namespace xmlns:rapi="http://marklogic.com/rest-api">
<rapi:prefix>will</rapi:prefix>
<rapi:uri>http://marklogic.com/examples/shakespeare</rapi:uri>
</rapi:namespace>
|
Example:
$ curl --anyauth --user user:password -X GET -i \
http://localhost:8004/v1/config/namespaces/will?format=json
==> MarkLogic Server responds with status 200 and returns the namespace
binding information for prefix "will", as JSON. For example:
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close
HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 67
Connection: close
{
"prefix":"will",
"uri":"http://marklogic.com/examples/shakespeare"
}
|
|
|
|
PUT /v1/config/namespaces/{prefix}
|
|
 |
Summary:
Create or modify a namespace binding.
|
Parameters:
format?
:
Specifies the type of the content in the request body. Accepted values:
json and xml (default). If there is no
format parameter, the format must be specified in the Accept header.
|
|
Request Headers:
Content-Type?:
The MIME type of the data in the request body, either
application/xml or application/json.
|
|
Required Privilege:
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
|
Response:
MarkLogic Server responds with status 201 (Content Created) if a new
prefix binding is created as a result of this request. MarkLogic Server
responds with status 204 (Content Updated) if an existing prefix binding
is updated as a result of this request.
|
Usage Notes:
For details, see 'Using Namespace Bindings' in the REST Application Developer's Guide.
The request body must have the following format when sending XML:
<namespace xmlns="http://marklogic.com/sdmp/group">
<prefix>the-prefix</prefix>
<namespace-uri>the-uri</namespace-uri>
</namespace>
The request body must have the following format when sending JSON:
{ "prefix" : "the-prefix", "uri" : "the-uri" }
|
Example:
$ cat ns-xml
<namespace xmlns="http://marklogic.com/group">
<prefix>bill</prefix>
<namespace-uri>http://marklogic.com/examples/shakespeare</uri>
<namespace>
$ curl --anyauth --user user:password -T './ns-xml' -i \
-H "Content-type: application/xml" \
http://localhost:8003/v1/config/namespaces/bill
==> Create or update a namespace binding between the prefix "bill" and the
namespace URI http://marklogic.com/examples/shakespeare. MarkLogic
Server returns the following headers:
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 31
Connection: close
HTTP/1.1 100 Continue
HTTP/1.1 204 Content Updated
Server: MarkLogic
Content-Length: 0
Connection: close
|
Example:
$ cat ns-json
{ "prefix" : "will", "uri" : "http://marklogic.com/examples/shakespeare" }
$ curl --anyauth --user user:password -T './ns-json' -i \
-H "Content-type: application/json" \
http://localhost:8003/v1/config/namespaces/will
==> Create or update a namespace binding between the prefix "will" and the
namespace URI http://marklogic.com/examples/shakespeare. MarkLogic
Server returns the following headers:
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 31
Connection: close
HTTP/1.1 100 Continue
HTTP/1.1 204 Content Updated
Server: MarkLogic
Content-Length: 0
Connection: close
|
|
|
|
DELETE /v1/config/properties
|
|
 |
Summary:
Reset all MarkLogic REST API instance configuration properties to their default values.
|
Required Privilege:
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
|
Response:
Upon success, MarkLogic Server returns status 204 (Content Deleted).
|
Usage Notes:
All properties are reset to their default values.
For more details, see
'Configuring Instance Properties' in the REST Application Developer's Guide.
|
Example:
$ curl --anyauth --user user:password -X DELETE -i \
http://localhost:8003/v1/config/properties
==> All configuration properties are reset to default values.
|
|
|
|
GET /v1/config/properties
|
|
 |
Summary:
Retrieve a list of all MarkLogic REST API instance configuration properties
names and settings.
|
Parameters:
format
:
Specifies the content type of the response, as an alternative to using
the Accept header. Accepted values: json and
xml (default). This value takes precedence over the Accept
headers.
|
|
Request Headers:
Accept*:
The expected MIME type of the information in the response.
Accepted types: application/json or
application/xml. Ignored if the request includes a
format parameter value.
|
|
Response Headers:
Content-Type:
The MIME type of the content returned in the response body, one of
application/xml or application/json,
depending on the type requested by the format value
or Accept header.
|
|
Required Privilege:
This operation requires the rest-reader role, or the
following privilege:
http://marklogic.com/xdmp/privileges/rest-reader
|
Response:
Upon success, MarkLogic Server returns a 200 status and provides the
requested information in the response body.
|
Usage Notes:
The expected response type can be specified using either the
format parameter or Accept header. One or
the other must be supplied. If both are supplied and are different,
the format parameter takes precedence.
For more details, see
'Retrieving Configuration Information' in the REST Application Developer's Guide.
|
Example:
$ curl --anyauth --user user:password -X GET -H "Accept: application/xml" -i \
http://localhost:8003/v1/config/properties
==> The instance configuration properties in the response body, as XML.
For example:
HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 87
Connection: close
<rapi:properties xmlns:rapi="http://marklogic.com/rest-api">
<rapi:debug>false</rapi:debug>
<rapi:document-transform-out/>
<rapi:error-format>xml</rapi:error-format>
<rapi:validate-options>true</rapi:validate-options>
<rapi:content-versions>none</rapi:content-versions>
</rapi:properties>
|
Example:
$ curl --anyauth --user user:password -X GET -H "Accept: application/json" -i \
http://localhost:8003/v1/config/properties
==> The instance configuration properties in the response body, as JSON.
For example:
HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 43
Connection: close
{
"content-versions":"none",
"validate-options":true,
"document-transform-out":"",
"debug":false,
"error-format":"xml"
}
|
|
|
|
PUT /v1/config/properties
|
|
 |
Summary:
Set or modify MarkLogic REST API instance configuration properties.
|
Parameters:
format
:
The content type of the information in the request body. Accepted types:
json or xml. This parameter takes precedence
over the Content-Type request header.
|
|
Request Headers:
Content-Type?:
The MIME type of the data in the request body, one of
application/xml or application/json.
The format parameter overrides the Content-type
header if both are present and do not match.
|
|
Required Privilege:
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
|
Response:
Upon success, MarkLogic Server responds with a 204 (Content Updated)
status.
|
Usage Notes:
Only the properties included in the request body are modified.
For a list of property names, see
GET /v1/config/properties/{name}.
For more details, see
'Configuring Instance Properties' in the REST Application Developer's Guide.
|
Example:
$ cat ./settings
<properties xmlns="http://marklogic.com/rest-api">
<debug>false</debug>
</properties>
$ curl --anyauth --user user:password -X POST -d@'./settings' -i \
"Content-Type: application/xml" \
http://localhost:8003/v1/config/properties
==> MarkLogic Server updates the settings for the properties named
in the settings file.
HTTP/1.1 204 Content Updated
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 5
Connection: close
|
Example:
$ cat ./settings
{"validate-options":"false"}
$ curl --anyauth --user user:password -X PUT -d@'./settings' -i \
"Content-Type: application/json" \
http://localhost:8003/v1/config/properties
==> MarkLogic Server updates the settings for the properties named
in the settings file.
HTTP/1.1 204 Content Updated
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 5
Connection: close
|
|
|
|
PUT /v1/config/properties/(property-name)
|
|
 |
Summary:
Set the value of the MarkLogic REST API instance configuration property named by
{property-name}.
|
Parameters:
format?
:
The MIME type of the metadata in the request body. Specifying a format
overrides the Content-Type request header value. See the usage notes
for details on special handling for XML, JSON, and binary content.
|
|
Request Headers:
Content-Type?:
The MIME type of the data in the request body, one of
application/xml or application/json.
|
|
Required Privilege:
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
|
Response:
Upon success, MarkLogic Server responds with status 204 (Content Updated).
|
Usage Notes:
For a list of property names, see
GET /v1/config/properties/{name}.
For more details, see
'Configuring Instance Properties' in the REST Application Developer's Guide.
|
Example:
$ cat setting
<rapi:debug xmlns:rapi="http://marklogic.com/rest-api">
true
</rapi:debug>
$ curl --anyauth --user user:password -T ./setting -i \
-H "Content-type: application/xml" \
http://localhost:8003/v1/config/properties/debug
==> The "debug" property is set to true. MarkLogc Server returns
the following headers:
HTTP/1.1 204 Content Updated
Server: MarkLogic
Content-Length: 0
Connection: close
|
Example:
$ cat setting
{ "debug" : "true" }
$ curl --anyauth --user user:password -T ./setting -i \
-H "Content-type: application/json" \
http://localhost:8003/v1/config/properties/debug
==> The "debug" property is set to true. MarkLogc Server returns
the following headers:
HTTP/1.1 204 Content Updated
Server: MarkLogic
Content-Length: 0
Connection: close
|
|
|
|
DELETE /v1/config/properties/{name-property}
|
|
 |
Summary:
Reset the MarkLogic REST API instance configuration property {property-name}
to its default value.
|
Required Privilege:
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
|
Response:
Upon success, MarkLogic Server returns status 204 (Content Deleted).
|
Usage Notes:
For a list of property names, see
GET /v1/config/properties/{name}.
For more details, see
'Configuring Instance Properties' in the REST Application Developer's Guide.
|
Example:
$ curl --anyauth --user user:password -X DELETE \
http://localhost:8003/v1/config/properties/debug
==> The "debug" configuration property is reset to its default value.
|
|
|
|
GET /v1/config/properties/{property-name}
|
|
 |
Summary:
Retrieve the value of the MarkLogic REST API instance configuration
property named by {property-name}.
|
Parameters:
format
:
Specifies the content type of the response, as an alternative to using
the Accept header. Accepted values: json and
xml (default). This value takes precedence over the Accept
headers.
|
|
Request Headers:
Accept:
The expected MIME type of the information in the response.
Accepted types: application/json or
application/xml. Ignored if the request includes a
format parameter value.
|
|
Response Headers:
Content-Type:
The MIME type of the content returned in the response body, one of
application/xml or application/json,
depending on the type requested by the format value
or Accept header.
|
|
Required Privilege:
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
|
Response:
Upon success, MarkLogic Server returns a 200 status, with the requested
data in the response body. If the requested property does not exist,
MarkLogic Server returns status 404 (Not Found).
|
Usage Notes:
The expected response content type can be specified using either the
format parameter or Accept header. One or
the other must be supplied. If both are supplied and are different,
the format parameter takes precedence.
The following properties are available for configuration:
| Propety Name |
Description |
| content-versions |
Determines the behavior of conditional GET, PUT and DELETE on
/documents. Allowed Values: required, optional, none.
Default: none. For more details, see
'Understanding Optimistic Locking' in the REST Application Developer's Guide. |
| debug |
Controls debugging output. Allowed values: true, false.
Default: false.
|
| document-transform-out |
The name of a default content transformation to apply when
retrieving documents from the database using /documents. Default:
no transformation.
|
| error-format |
The content type of error responses. Allowed values: xml, json.
Default: xml.
|
| validate-options |
Whether or not to validate query options when they are created
or updated. Allowed values: true, false. Default: true. |
For more details, see
'Configuring Instance Properties' in the REST Application Developer's Guide.
|
Example:
$ curl --anyauth --user user:password -X GET -i \
http://localhost:8003/v1/config/properties/debug
==> MarkLogic Server returns the setting of the configuration property
"debug", as XML. For example:
HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 74
Connection: close
<rapi:debug xmlns:rapi="http://marklogic.com/rest-api">
false
</rapi:debug>
|
Example:
$ curl --anyauth --user user:password -X GET -i \
http://localhost:8003/v1/config/properties/debug?format=json
==> MarkLogic Server returns the setting of the configuration property
"debug", as JSON. For example:
HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 15
Connection: close
{"debug":false}
|
|
|
|
|
 |
Summary:
Remove all named query options.
|
Required Privilege:
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
|
Response:
Upon successful removal, MarkLogic returns status 204 (Content Deleted).
|
Usage Notes:
For more details, see
'Configuring Query Options' in the REST Application Developer's Guide.
|
Example:
$ curl --anyauth --user user:password -X DELETE -i \
http://localhost:8003/v1/config/query
==> All installed options are removed. The following headers are returned:
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 31
Connection: close
HTTP/1.1 204 Content Deleted
Server: MarkLogic
Content-Length: 0
Connection: close
|
|
|
|
|
 |
Summary:
Retrieve a list of all the named query options available for use
with the service. For example, the names of query options previously
stored using POST requests on the /config/query endpoint.
The results include the name and URI of all named query options.
|
Parameters:
format
:
Specifies the content type of the response, as an alternative to using
the Accept header. Accepted values: json and
xml (default). This value takes precedence over the Accept
headers.
|
|
Request Headers:
Accept*:
The expected MIME type of the information in the response.
Accepted types: application/json or
application/xml. Ignored if the request includes a
format parameter value.
|
|
Response Headers:
Content-Type:
The MIME type of the data in the response, either
application/json or application/xml,
depending upon the MIME type requested through the format
parameter or Accept header on the request.
|
|
Required Privilege:
This operation requires the rest-reader role, or the
following privilege:
http://marklogic.com/xdmp/privileges/rest-reader
|
Response:
Upon success, MarkLogic Server returns a status 200 (OK) and the
response body contains the options data. If no query options are
installed, MarkLogic Server returns an empty <query-options>
node (XML) or an empty array (JSON).
|
Usage Notes:
The expected response type can be specified using either the
format parameter or Accept header. One or
the other must be supplied. If both are supplied and are different,
the format parameter takes precedence.
For more details, see
'Configuring Query Options' in the REST Application Developer's Guide.
|
Example:
$ curl --anyauth --user user:password -X GET -i \
http://localhost:8003/v1/config/query
==> A list of the names of installed options, as XML. Assuming two named
query options, "scene" and "title" were previously installed:
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 31
Connection: close
HTTP/1.1 200 OK
Content-type: text/xml; charset=UTF-8
Server: MarkLogic
Content-Length: 318
Connection: close
<rapi:query-options xmlns:rapi="http://marklogic.com/rest-api">
<rapi:options>
<rapi:name>default</rapi:name>
<rapi:uri>/v1/config/query/default</rapi:uri>
</rapi:options>
<rapi:options>
<rapi:name>title</rapi:name>
<rapi:uri>/v1/config/query/title</rapi:uri>
</rapi:options>
<rapi:options>
<rapi:name>scene</rapi:name>
<rapi:uri>/v1/config/query/scene</rapi:uri>
</rapi:options>
</rapi:query-options>
|
Example:
$ curl --anyauth --user user:password -X GET -i \
http://localhost:8003/v1/config/query?format=json
==> A list of the names of installed options, as JSON. Assuming two named
query options, "scene" and "title" were previously installed:
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 31
Connection: close
HTTP/1.1 200 OK
Content-type: text/plain; charset=UTF-8
Server: MarkLogic
Content-Length: 318
Connection: close
[
{
"name": "default",
"uri": "\/v1\/config\/query\/default"
},
{
"name": "title",
"uri": "\/v1\/config\/query\/title"
},
{
"name": "scene",
"uri": "\/v1\/config\/query\/scene"
}
]
|
|
|
|
DELETE /v1/config/query/(default|{name})
|
|
 |
Summary:
Remove the named (or default) query options from the App Server.
|
Required Privilege:
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
|
Response:
Upon success, MarkLogic Server returns a 204 (Content Deleted) status.
|
Usage Notes:
For more details, see
'Configuring Query Options' in the REST Application Developer's Guide.
|
Example:
$ curl --anyauth --user user:password -X DELETE -i \
http://localhost:8003/v1/config/query/scene
==> MarkLogic Server removes the options installed under the
name "scene". The response includes the following headers:
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 31
Connection: close
HTTP/1.1 204 Content Deleted
Server: MarkLogic
Content-Length: 0
Connection: close
|
|
|
|
GET /v1/config/query/(default|{name})
|
|
 |
Summary:
Retrieve the query options whose name matches the name in the
request URI, or retrieve the default query options.
|
Parameters:
format
:
Specifies the content type of the response, as an alternative to using
the Accept header. Accepted values: json and
xml (default). This value takes precedence over the Accept
headers.
|
|
Request Headers:
Accept*:
The expected MIME type of the information in the response.
Accepted types: application/json or
application/xml. Ignored if the request includes a
format parameter value.
|
|
Response Headers:
Content-Type:
The MIME type of the data in the response, either
application/json or application/xml,
depending upon the MIME type requested through the format
parameter or Accept header on the request.
|
|
Required Privilege:
This operation requires the rest-reader role, or the
following privilege:
http://marklogic.com/xdmp/privileges/rest-reader
|
Response:
Upon success, MarkLogic Server responds with a status 200 (OK) and
returns the requested information in the response body, XML or JSON.
If the named configuration does not exist, MarkLogic Server
returns a 404 status.
|
Usage Notes:
The response body contains a list of search:options nodes,
expressed in either XML or JSON, depending upon the format
parameter or Accept header setting. For details on the options, see
PUT /v1/config/query/(default|{name}).
The returned configuration does not include configuration
inherited at runtime from the default or global query options.
The XML or JSON structure returned by this method is suitable for
passing to a PUT or POST request to /config/query.
For more details, see
'Configuring Query Options' in the REST Application Developer's Guide.
|
Example:
$ curl --anyauth --user user:password -X GET -i \
http://localhost:8003/v1/config/query/title
==> The query options previously saved under the name "title".
For example:
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 31
Connection: close
HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 172
Connection: close
<options xmlns="http://marklogic.com/appservices/search">
<constraint name="title">
<word>
<element ns="" name="TITLE"/>
</word>
</constraint>
</options>
|
Example:
$ curl --anyauth --user user:password -X GET -i \
http://localhost:8003/v1/config/query/tuples?format=json
==> The query options previously saved under the name "tuples".
For example:
Content-type: application/xml
Server: MarkLogic
Content-Length: 211
Connection: close
HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 271
Connection: close
{
"options": {
"tuples": [
{
"name": "speaker-title",
"range": [
{
"type": "xs:string",
"element": {
"ns": "",
"name": "SPEAKER"
}
},
{
"type": "xs:string",
"path-index": {
"text": "\/PLAY\/ACT\/SCENE\/TITLE"
}
}
]
}
],
"constraint": [
{
"name": "title",
"word": {
"element": {
"ns": "",
"name": "TITLE"
}
}
}
]
}
}
|
|
|
|
POST /v1/config/query/(default|{name})
|
|
 |
Summary:
Create or append to named query options.
|
Parameters:
format
:
The content type of the information in the request body. Accepted types:
json or xml. This parameter takes precedence
over the Content-Type request header.
|
|
Request Headers:
Content-Type:
The MIME type of the data in the POST body, either
application/json or application/xml.
Ignored if the request includes a format parameter.
|
|
Required Privilege:
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
|
Response:
Upon success, MarkLogic Server returns status 201 (Content Created) or
204 (Content Updated).
If the payload is invalid, MarkLogic Server responds with status 400
by default. However, validation may be disabled. For details, see
/config/properties.
|
Usage Notes:
The POST body must be a valid search:options node, expressed
in either XML or JSON, depending upon the request Content-Type header or
format parameter. For options information, see
PUT /v1/config/query/(default|{name}).
If the named options do not exist, new ones are created.
If the named options exist, the options in the POST body are added
to the existing definition.
If {name} is default, default query
options are installed or updated.
Named query options are versioned by MarkLogic server. The version
identifier returned in the response ETag header may be
used in subsequent conditional GET requests on the
/config/query/{name} endpoint to restrict requests to
particular option versions.
For a summary of available options, see
PUT /v1/config/query/(default|{name}). For details see
'Appendix A: JSON Query Options Reference' in the REST Application Developer's Guide or
'Appendix B: XML Query Options Reference' in the REST Application Developer's Guide.
For more details, see
'Configuring Query Options' in the REST Application Developer's Guide.
|
Example:
$ cat > options
<options xmlns="http://marklogic.com/appservices/search">
<constraint name="title">
<word>
<element ns="" name="TITLE" />
</word>
</constraint>
</options>
$ curl --anyauth --user user:password -X POST -d@'./options' -i \
-H "Content-type:application/xml" \
http://localhost:8003/v1/config/query/title
==> Install options named "title" which constrains searches
to words in the TITLE element. The request returns headers of
the form:
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 31
Connection: close
HTTP/1.1 201 Content Created
Location:
Server: MarkLogic
Content-Length: 0
Connection: close
|
|
|
|
PUT /v1/config/query/(default|{name})
|
|
 |
Summary:
Create or replace named query options.
|
Parameters:
format
:
The content type of the information in the request body. Accepted types:
json or xml. This parameter takes precedence
over the Content-Type request header.
|
|
Request Headers:
Content-type:
The MIME type of the data in the request body, either
application/json or application/xml.
Ignored if the request includes a format parameter.
|
|
Required Privilege:
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
|
Response:
Upon success, MarkLogic Server returns status 201 (Content Created) or
204 (Content Updated).
If the payload is invalid, MarkLogic Server responds with status 400
by default. However, validation may be disabled. For details, see
/config/properties.
|
Usage Notes:
For more details, see
'Configuring Query Options' in the REST Application Developer's Guide.
The request body must be a valid search:options node,
expressed in either XML or JSON, depending upon the request Content-Type
header or format parameter. See the Usage Notes, below.
By default, options are validated. Options validation can be disabled
using the /config/properties service.
If the named options do not exist, they are created.
If the named options exist, the options in the request body replace
the existing query options.
If {name} is default, the default search
options are modified.
Query options are expressed as a multi-level JSON or XML structure.
The following list is brief summary of the top level option XML elements
or JSON objects. For details, see
'Controlling the Search With the Options Node' in the Search Developer's Guide, 'Appendix A: JSON Query Options Reference' in the REST Application Developer's Guide, or
'Appendix B: XML Query Options Reference' in the REST Application Developer's Guide.
- additional-query
-
Additional serialized queries that are AND'd with any string
or structured query supplied to a request.
- concurrency-level
-
The maximum number of threads used to resolve facets.
- constraint
-
Constraints used to control the search and faceting.
- debug
-
Activate debugging mode.
- default-suggestion-source
-
Define content to be used as the default source of search
suggestions.
- extract-metadata
-
Specify data to return in the
metadata section of
the response output.
- forest
-
One or more forest ids.
- fragment-scope
-
The global fragment scope over which to search, either properties
or documents.
- grammar
-
Specify a custom search grammar. The default grammar defines
"Google-style" parsing.
- operator
-
A list of state elements, each representing a unique runtime
configuration option.
- page-length
-
The number of results per page. The default is 10.
- quality-weight
-
A weighting factor to use in the query. The default is 1.0.
- return-aggregates
-
Whether to include results from builtin or user-defined
aggregate functions in the search response. Default: true.
- return-constraints
-
Whether to include the original constraint definitions in the
results. Default: false.
- return-facets
-
Whether to include resolved facets in the results. Default: true.
- return-frequencies
-
Whether to include value frequencies in range indexes and lexicons
in the results. Default: true.
- return-metrics
-
Whether to include statistics in the results. Default: true.
- return-plan
-
Whether to include
xdmp:plan output in the
results. Default: false.
- return-qtext
-
Whether to include the original query text in the results.
Default: true.
- return-query
-
Whether to include the XML query representation in the results.
Default: false.
- return-results
-
Whether to include search results in the output. Default: true.
- return-similar
-
Whether to include a list of URLS of similar documents with
each search result. Default: false.
- return-values
-
Whether to include values from range indexes and lexicons in
the results. Default: true.
- search-option
-
For advanced usrs. Additional options to pass in, such as
filtered, unfiltered, and
score-logtfidf. Default: No additional options.
- searchable-expression
-
An expression to search. Whatever expression is specified
is return from the search.
- sort-order
-
Set the default sort order.
- suggestion-source
-
A constraint source to override a named constraint when using
search:suggest.
- term
-
Specifies handling of empty searches and controls option
for how individual are represented when parsing the search.
- transform-results
-
Specifies a function for processing search results to create
snippet output.
- tuples
-
Specifies constraints for finding value range index and
lexicon co-ocurrences.
- values
-
Specifies constraints for finding values in range indexes and
lexicons.
|
Example:
$ curl --anyauth --user user:password -T './options2' -i \
-H "Content-type:application/xml" \
http://localhost:8003/v1/config/query/scene
==> MarkLogic Server creates or updates the query options named "scene".
The response includes the following headers:
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 31
Connection: close
HTTP/1.1 100 Continue
HTTP/1.1 204 Content Updated
Server: MarkLogic
Content-Length: 0
Connection: close
|
|
|
|
DELETE /v1/config/query/(default|{name})/{child-element}
|
|
 |
Summary:
Remove an option setting from the named query options.
|
Required Privilege:
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
|
Response:
MarkLogic Server returns status 204 Content Deleted status.
|
Usage Notes:
{child-element} should be the name of a child element of
a search:options node. For an option summary, see
PUT /v1/config/query/(default|{name}).
For details, see
'Appendix A: JSON Query Options Reference' in the REST Application Developer's Guide or
'Appendix B: XML Query Options Reference' in the REST Application Developer's Guide.
If {child-element} is unrecognized, this request does nothing.
If the named query options contain multiple occurrences of the
child element, MarkLogic Server deletes all occurrences. For example,
DELETE /v1/config/query/my-options/constraint deletes all
<constraint/> elements of "my-options".
For more details, see
'Configuring Query Options' in the REST Application Developer's Guide.
|
Example:
|
|
|
|
GET /v1/config/query/(default|{name})/{child-element}
|
|
 |
Summary:
Retrieve the setting for a particular option in named query options.
|
Parameters:
format
:
Specifies the content type of the response, as an alternative to using
the Accept header. Accepted values: json and
xml (default). This value takes precedence over the Accept
headers.
|
|
Request Headers:
Accept*:
The expected MIME type of the information in the response.
Accepted types: application/json or
application/xml. Ignored if the request includes a
format parameter value.
|
|
Response Headers:
Content-Type:
The MIME type of the data in the response, either
application/json or application/xml,
depending upon the MIME type requested through the format
parameter or Accept header on the request.
|
|
Required Privilege:
This operation requires the rest-reader role, or the
following privilege:
http://marklogic.com/xdmp/privileges/rest-reader
|
Response:
Upon success, MarkLogic Server responds with a 200 staus and returns
the requested information in the response body, in the format requested.
|
Usage Notes:
The {element-name} component of the request URI must be
the localname of a child element of search:options. For
information on query options, see
PUT /v1/config/query/(default|{name}).
The response body contains a search:options node, expressed
as either XML or JSON, depending on the setting of the format
parameter or Accept header. The returned options node contains only
the request child element(s). For information about the structure and
contents of query options, see
PUT /v1/config/query/(default|{name}).
For more details, see
'Configuring Query Options' in the REST Application Developer's Guide.
|
Example:
Assume the following options are installed under the name "my-options":
<options xmlns="http://marklogic.com/appservices/search">
<values name="speaker">
<range type="xs:string">
<element ns="" name="SPEAKER"/>
</range>
</values>
<tuples name="speaker-title">
<range type="xs:string">
<element ns="" name="SPEAKER"/>
</range>
<range type="xs:string">
<path-index>/PLAY/ACT/SCENE/TITLE</path-index>
</range>
</tuples>
</options>
$ curl --anyauth --user user:password -i -X GET \
http://localhost:8003/v1/config/query/my-options/values
==> MarkLogic Server returns the following headers and the requested
subset of my-options. Results are in the default format, XML.
HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 187
Connection: close
<options xmlns="http://marklogic.com/appservices/search">
<values name="speaker">
<range type="xs:string">
<element ns="" name="SPEAKER"/>
</range>
</values>
</options>
|
Example:
Assume the following options are installed under the name "my-options":
{
"options": {
"values": [
{
"name": "speaker",
"range": {
"type": "xs:string",
"element": {
"ns": "",
"name": "SPEAKER"
}
}
}
],
"tuples": [
{
"name": "speaker-title",
"range": [
{
"type": "xs:string",
"element": {
"ns": "",
"name": "SPEAKER"
}
},
{
"type": "xs:string",
"path-index": {
"text": "\/PLAY\/ACT\/SCENE\/TITLE"
}
}
]
}
]
}
}
$ curl --anyauth --user user:password -i -X GET \
http://localhost:8003/v1/config/query/my-options/values?format=json
==> MarkLogic Server returns the following headers and the requested
subset of my-options, as JSON.
HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 112
Connection: close
{
"options": {
"values": [
{
"name": "speaker",
"range": {
"type": "xs:string",
"element": {
"ns": "",
"name": "SPEAKER"
}
}
}
]
}
}
|
|
|
|
POST /v1/config/query/(default|{name})/{child-element}
|
|
 |
Summary:
Add options to existing named query options, or create new named
query options if {name} does not already exist.
|
Parameters:
format
:
The content type of the information in the request body. Accepted types:
json or xml. This parameter takes precedence
over the Content-Type request header.
|
|
Request Headers:
Content-Type:
The MIME type of the data in the request body. Accepted values:
application/json or application/xml.
Ignored if the format parameter is present.
|
|
Required Privilege:
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
|
Response:
Upon success, MarkLogic Server returns status 201 (Content Created) or
204 (Content Updated).
If the payload is invalid or applying the payload results in invalid
query options, MarkLogic Server responds with status 400 (Bad Request)
by default. Options validation can be disabled. For details, see
see the validate-options in
'Instance Configuration Properties' in the REST Application Developer's Guide.
|
Usage Notes:
The POST body must be a valid search:options node, expressed
in either XML or JSON, depending upon the request Content-Type header or
format parameter.
For a summary of available options, see
PUT /v1/config/query/(default|{name}).
For details see
'Appendix A: JSON Query Options Reference' in the REST Application Developer's Guide or
'Appendix B: XML Query Options Reference' in the REST Application Developer's Guide.
Multiple option elements (settings) may be included in the options node
if {child-element} is an element that can occur multiple times
in query options. For example, multiple search constraints
(<constraint/>) may be set in a single request.
However, all options in the payload must be of the same type.
If no query options are installed under {name}, they are
created. If the named query options exist, the options in the POST
body are appended. If options validation is enabled (the default)
and adding the new options would result in invalid query options,
the query options remain unchanged, and a 400 status is returned.
Options validation can be disabled. For details, see
validate-options in
'Instance Configuration Properties' in the REST Application Developer's Guide.
If {name} is default, the default search
options are modified.
For more details, see
'Configuring Query Options' in the REST Application Developer's Guide.
|
Example:
$ cat added-constraint.xml
<options xmlns="http://marklogic.com/appservices/search">
<constraint name="title">
<word>
<element ns="" name="TITLE" />
</word>
</constraint>
</options>
$ curl --anyauth --user user:password -i -X POST -d@"added-constraint.xml" \
-H "Content-type: application/xml" \
http://localhost:8003/v1/config/query/my-options/constraint
==> The "title" constraint is added to the "my-options" query options. If
the query options already contain other <constraint/> elements, they
are unchanged. MarkLogic Server returns the following headers:
HTTP/1.1 201 Content Created
Location:
Server: MarkLogic
Content-Length: 0
Connection: close
|
Example:
$ cat added-constraint.json
{
"options": {
"constraint": [
{
"name": "title",
"word": {
"element": {
"ns": "",
"name": "TITLE"
}
}
}
]
}
}
$ curl --anyauth --user user:password -i -X POST -d@"added-constraint.json" \
-H "Content-type: application/json" \
http://localhost:8003/v1/config/query/my-options/constraint
==> The "title" constraint is added to the "my-options" query options. If
the query options already contain other <constraint/> elements, they
are unchanged. MarkLogic Server returns the following headers:
HTTP/1.1 201 Content Created
Location:
Server: MarkLogic
Content-Length: 0
Connection: close
|
|
|
|
PUT /v1/config/query/(default|{name})/{child-element}
|
|
 |
Summary:
Replace options in existing named query options, or create new named
query options if {name} does not already exist.
|
Parameters:
format
:
The content type of the information in the request body. Accepted types:
json or xml. This parameter takes precedence
over the Content-Type request header.
|
|
Request Headers:
Content-Type:
The MIME type of the data in the request body. Accepted values:
application/json or application/xml.
Ignored if the format parameter is present.
|
|
Required Privilege:
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
|
Response:
Upon success, MarkLogic Server responds with
status 201 (Content Created) or 204 (Content Updated).
If the payload is invalid or applying the payload results in invalid
query options, MarkLogic Server responds with status 400 (Bad Request)
by default. Options validation can be disabled. For details, see
see the validate-options in
'Instance Configuration Properties' in the REST Application Developer's Guide.
|
Usage Notes:
The request payload should be a valid search:options node,
expressed in either XML or JSON, depending upon the request Content-Type
header or format parameter. For a summary of available options, see
PUT /v1/config/query/(default|{name}).
For details, see
'Appendix A: JSON Query Options Reference' in the REST Application Developer's Guide or
'Appendix B: XML Query Options Reference' in the REST Application Developer's Guide.
If no query options are installed under {name}, they are
created. If the named query options exist, the options in the request
body replace all existing option elements with the same name.
For example, if the query options contains three
<constraint/> options and the request body includes
only one <constraint/>, the three existing constraints
are removed and replaced with the one in the request body.
If options validation is enabled (the default) and the new options
would result in invalid query options, the query options remain
unchanged, and a 400 status is returned. Options validation can be
disabled. For details, see
validate-options in
'Instance Configuration Properties' in the REST Application Developer's Guide.
The request body can contain multiple option elements (settings)
if {child-element} is an element that can occur multiple times
in query options. For example, multiple search constraints
(<constraint/>) can be set in a single request.
However, all options in the payload must be of the same type.
If the named query options do not exist, create new named query options.
If the named query options exist, the options in the request body replace
any existing options of the same name. For example, if the query options
contains 3 constraint options and the PUT request includes only one
constraint, all 3 constraints are removed and replaced with the single
constraint from the request.
If {name} is default, the default search
options are modified.
For more details, see
'Configuring Query Options' in the REST Application Developer's Guide.
|
Example:
$ cat added-constraint.xml
<options xmlns="http://marklogic.com/appservices/search">
<constraint name="title">
<word>
<element ns="" name="TITLE" />
</word>
</constraint>
</options>
$ curl --anyauth --user user:password -i -X PUT -d@"added-constraint.xml" \
-H "Content-type: application/xml" \
http://localhost:8003/v1/config/query/my-options/constraint
==> The "title" constraint is added to the "my-options" query options. If
the query options already contain other <constraint/> elements, they
are removed. MarkLogic Server returns the following headers:
HTTP/1.1 204 Content Updated
Location:
Server: MarkLogic
Content-Length: 0
Connection: close
|
Example:
$ cat added-constraint.json
{
"options": {
"constraint": [
{
"name": "title",
"word": {
"element": {
"ns": "",
"name": "TITLE"
}
}
}
]
}
}
$ curl --anyauth --user user:password -i -X PUT -d@"added-constraint.json" \
-H "Content-type: application/json" \
http://localhost:8003/v1/config/query/my-options/constraint
==> The "title" constraint is added to the "my-options" query options. If
the query options already contain other <constraint/> elements, they
are removed. MarkLogic Server returns the following headers:
HTTP/1.1 204 Content Updated
Location:
Server: MarkLogic
Content-Length: 0
Connection: close
|
|
|
|
GET /v1/config/transforms
|
|
 |
Summary:
Retrieve metadata about all transforms installed using the
/v1/config/transforms/{name} endpoint.
|
Parameters:
format
:
Specifies the content type of the response, as an alternative to using
the Accept header. Accepted values: json and
xml (default). This value takes precedence over the Accept
headers.
|
|
Request Headers:
Accept:
The expected MIME type of the information in the response.
Accepted types: application/json or
application/xml. Ignored if the request includes a
format parameter value.
|
|
Required Privilege:
This operation requires the rest-reader role, or the
following privilege:
http://marklogic.com/xdmp/privileges/rest-reader
|
Response:
Upon success, MarkLogic Server returns status 200 (Transform List
Retrieved) and returns the requested information in the response body.
|
Usage Notes:
For more details, see
'Discovering Transformations' in the REST Application Developer's Guide.
The expected response type can be specified using either the
format parameter or Accept header. One or
the other must be supplied. If both are supplied and are different,
the format parameter takes precedence.
|
Example:
$ curl --anyauth --user user:password -i -X GET -H "Accept: application/xml" \
http://localhost:8004/v1/config/transforms
==> A list of installed transforms and their metadata, as XML. For example:
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close
HTTP/1.1 200 Transform List Retrieved
Content-type: application/xml
Server: MarkLogic
Content-Length: 101
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<rapi:transforms xmlns:rapi="http://marklogic.com/rest-api">
<rapi:transform>
<rapi:name>example</rapi:name>
<rapi:title>example transform</rapi:title>
<rapi:version/>
<rapi:provider-name/>
<rapi:description/>
<rapi:transform-parameters>
<rapi:parameter>
<rapi:parameter-name>style?</rapi:parameter-name>
<rapi:parameter-type>xs:string</rapi:parameter-type>
</rapi:parameter>
<rapi:parameter>
<rapi:parameter-name>tag</rapi:parameter-name>
<rapi:parameter-type>xs:string</rapi:parameter-type>
</rapi:parameter>
</rapi:transform-parameters>
<rapi:transform-source>/v1/transforms/example</rapi:transform-source>
</rapi:transform>
</rapi:transforms>
|
Example:
$ curl --anyauth --user user:password -i -X GET \
http://localhost:8004/v1/config/transforms?format=json
==> A list of installed transforms and their metadata, as JSON. For example:
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close
HTTP/1.1 200 Transform List Retrieved
Content-type: application/json
Server: MarkLogic
Content-Length: 331
Connection: close
{
"transforms": {
"transform": [
{
"name": "example",
"title": "example transform",
"version": "",
"provider-name": "",
"description": "example transform",
"transform-parameters": {
"parameter": [
{
"parameter-name": "style",
"parameter-type": "xs:string?"
},
{
"parameter-name": "tag",
"parameter-type": "xs:string"
}
]
},
"transform-source": "\/v1\/transforms\/example"
}
]
}
}
|
|
|
|
DELETE /v1/config/transforms/{name}
|
|
 |
Summary:
Remove the named transform.
|
Required Privilege:
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
|
Response:
Upon successful removal, MarkLogic Server returns status 204 (Transform
Deleted).
|
Usage Notes:
For details, see
'Working With Content Transformations' in the REST Application Developer's Guide.
|
Example:
$ curl --anyauth --user user:password -X DELETE -i \
http://localhost:8004/v1/config/transforms/example
==> The transform named "example" is uninstalled. MarkLogic Server
responds with headers of the form:
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close
HTTP/1.1 204 Transform Deleted
Server: MarkLogic
Content-Length: 0
Connection: close
|
|
|
|
GET /v1/config/transforms/{name}
|
|
 |
Summary:
Retrieve the XQuery or XSLT implementation installed for the
named transform.
|
Request Headers:
Accept?:
The MIME type of the data expected in the response, either
application/xslt+xml or application/xquery.
|
|
Response Headers:
Content-Type:
The MIME type of the data in the response, either
application/xslt+xml or
application/xslt+xml or application/xquery.
|
|
Required Privilege:
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
|
Response:
Upon success, MarkLogic Server responds with status 200 (Transform
Retrieved) and returns the transform implementation in the response body.
|
Usage Notes:
For details, see
'Retrieving the Implementation of a Transformation' in the REST Application Developer's Guide.
To install a transform, use PUT /v1/config/transforms/{name}.
To retrieve a list of available transforms use
GET /v1/config/transforms.
|
Example:
$ curl --anyauth --user user:password -X GET -i \
-H "Accept: application/xquery" \
http://localhost:8004/v1/config/transforms/example
==> The XQuery library module implementing the "example" transform.
For example:
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 211
Connection: close
HTTP/1.1 200 Transform Retrieved
Content-type: application/xquery
Server: MarkLogic
Content-Length: 508
Connection: close
xquery version "1.0-ml";
module namespace example="http://marklogic.com/rest-api/transform/example";
declare function example:transform(
...
|
|
|
|
PUT /v1/config/transforms/{name}
|
|
 |
Summary:
Create or update the named transform.
|
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?
:
Specifies the MIME type of the request body, as an alternative to
specifying format via the Accept header. Accepted values:
xslt or xquery. This value takes
precedence over the Accept headers.
|
|
Request Headers:
Content-Type:
The MIME type of the data in the request body, one of
application/xslt+xml or application/xquery.
Ignored if a format parameter is present.
|
|
Required Privilege:
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
|
Response:
Upon success, MarkLogic Server responds with status 204 (Transform
Created).
|
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.
Transform metadata such as author, version, and description may be
supplied via either request parameters or in an XML manifest file.
You may only use an XML manifest by including it in a zip file and
using format=zip or a Content-Type header of
application/zip.
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 Transform Created
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 4
Connection: close
|
|
|