PUT /api/v2/table/{path}/document/{id}

Updates a single document by id in a MapR Database JSON table

Parameters

Name Description
path

string

(path)

Required: Path to the MapR Database JSON table
id

string

(path)

Required: Id of the document to update. If the document with the specified id does not exist, the mode parameter determines the behavior.
condition

string

(query)

Query condition (in JSON format) used to perform OJAI DocumentStore.checkAndReplace evaluation. See OJAI Query Condition Syntax for a description of the syntax.
mode

string

(query)

Defines the behavior of the operation.
The following are the possible values:
  • insertOrReplace - Inserts new document if specified document ID does not exist; otherwise, replaces existing document specified by the ID.

  • insert - Inserts new document; if the specified document ID already exists, returns an error.

  • replace - Replaces document with specified ID if it exists

Default: insertOrReplace

body

(body)

Required: The body of the new document

Request Example

The following replaces the document with id user001 in /apps/employees with an employee who has only a first name:
curl -X PUT \
'https://10.10.100.42:8243/api/v2/table/%2Fapps%2Femployees/document/user001' \
  -H 'Content-Type: application/json' \
  -u root:mapr \
  -d '{"_id":"user001","first_name":"Jonathan"}'

Response Example

200 OK