Loading TOC...

MarkLogic 10 Product Documentation
POST /manage/v2/meters/labels

Summary

This resource address creates a label and returns the ID of the created label.

The label name must be unique. The event element in the payload body must be either marker or duration.

URL Parameters
format The format of the posted data. Can be either json (default) or xml. This value overrides the Accept header if both are present.
Request Headers
Accept The expected MIME type of the request body. If the format parameter is present, it takes precedence over the Accept header.
Content-type The MIME type of the data in the request body, either application/xml or application/json.
Response Headers
Content-type The MIME type of the data in the response body. Depending upon the value of the format parameter or Accept header, either application/xml or application/json.

Response

Upon success, MarkLogic Server returns status code 200 (OK) and the ID of the created label.

Required Privileges

This operation requires the manage-admin role, or the following privilege:

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

Usage Notes

The structure of the data in the request body is as follows:

label:label

Example


cat label.xml
==>
  <label xmlns="http://marklogic.com/manage/meters/label">
     <name>new label</name>  
     <event>marker</event>         
     <start_dt>2013-10-08T00:00:00</start_dt>
     <end_dt>2013-10-09T00:00:00</end_dt>
     <text>label text</text>
     <meta><info>more information</info></meta>
   </label>

curl -i -X POST --digest -u admin:password \
     -H "Content-type: application/xml" -d @label.xml \
     http://localhost:8002/manage/v2/meters/labels

==> Posts the label to MarkLogic Server and returns the 
    generated id.
    

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.