classMLRest
Source: ml-rest.
low-level angular service, encapsulates REST API builtins and normalizes the responses.
Methods
new MLRest($http)
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
$http |
Object |
|
angular $http service |
Methods
createDocument(doc[, options]) → Promise
Creates a document, returning the new URI
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
doc |
(Object or String) |
|
document contents |
|
options |
Object |
Yes |
URL params |
- Returns
-
Promisea promise resolved with the new document URI
deleteDocument(uri, options) → Promise
Deletes a document at the specified URI
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
uri |
String |
|
document uri |
|
options |
Object |
|
URL params |
- Returns
-
Promisea promise resolved with an angular$httpservice response object
extension(name, settings) → Promise
Makes a resource extension request
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
name |
String |
|
resource extension name |
|
settings |
Object |
|
angular |
- Returns
-
Promisea promise resolved with an angular$httpservice response object
getDocument(uri, options) → Promise
Retrieves a document at the specified URI
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
uri |
String |
|
document URI |
|
options |
Object |
|
URL params |
- Returns
-
Promisea promise resolved with an angular$httpservice response object
patchDocument(uri, patch) → Promise
Applies the provided patch to the document at the specified URI
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
uri |
String |
|
document URI |
|
patch |
Object |
|
a document patch definition |
- Returns
-
Promisea promise resolved with the new document URI
queryConfig(name[, section]) → Promise
Retrieves stored search options
- http://docs.marklogic.com/REST/GET/v1/config/query/['default'-or-name]
- http://docs.marklogic.com/REST/GET/v1/config/query/['default'-or-name]/[child-element]
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
name |
String |
|
stored search options name |
|
section |
String |
Yes |
options section to retrieve |
- Returns
-
Promisea promise resolved with an angular$httpservice response object
request(endpoint, settings) → Promise
Makes a REST API request (all other methods wrap this)
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
endpoint |
String |
|
the request endpoint: can be version agnostic ( |
|
settings |
Object |
|
angular |
- Returns
-
Promisea promise resolved with an angular$httpservice response object
search([options][, combined]) → Promise
Makes a search request (POST if combined query, GET otherwise)
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
options |
Object |
Yes |
URL params |
|
combined |
Object |
Yes |
a combined search object (identified by a |
- Returns
-
Promisea promise resolved with an angular$httpservice response object
sparql(query[, params]) → Promise
Evaluates a SPARQL query
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
query |
String |
|
a SPARQL query |
|
params |
Object |
Yes |
URL params |
- Returns
-
Promisea promise resolved with an angular$httpservice response object
suggest([params][, combined]) → Promise
Retrieves search phrase suggestions
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
params |
Object |
Yes |
URL params |
|
combined |
Object |
Yes |
combined query |
- Returns
-
Promisea promise resolved with an angular$httpservice response object
updateDocument(doc, options) → Promise
Creates or updates a document at the specified URI (options.uri)
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
doc |
(Object or String) |
|
document contents |
|
options |
Object |
|
URL params |
- Returns
-
Promisea promise resolved with the new document URI
values(name[, params][, combined]) → Promise
Retrieves lexicon values
- http://docs.marklogic.com/REST/GET/v1/values/[name]
- http://docs.marklogic.com/REST/POST/v1/values/[name]
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
name |
String |
|
values definition name (from stored or combined search options) |
|
params |
Object |
Yes |
URL params |
|
combined |
Object |
Yes |
combined query |
- Returns
-
Promisea promise resolved with an angular$httpservice response object