public class AddCommand extends AbstractCommand implements CouchCommand
http://docs.couchdb.org/en/2.0.0/api/document/common.html PUT /{db}/{docid} The PUT method creates a new named document, or creates a new revision of the existing document. Unlike the POST /{db}, you must specify the document ID in the request URL. Parameters: db – Database name docid – Document ID Request Headers: Accept – application/json text/plain Content-Type – application/json If-Match – Document’s revision. Alternative to rev query parameter X-Couch-Full-Commit – Overrides server’s commit policy. Possible values are: false and true. Optional Query Parameters: batch (string) – Stores document in batch mode. Possible values: ok. Optional new_edits (boolean) – Prevents insertion of a conflicting document. Possible values: true (default) and false. If false, a well-formed _rev must be included in the document. new_edits=false is used by the replicator to insert documents into the target database even if that leads to the creation of conflicts. Optional Response Headers: Content-Type – application/json text/plain; charset=utf-8 ETag – Quoted document’s new revision Location – Document URI Response JSON Object: id (string) – Document ID ok (boolean) – Operation status rev (string) – Revision MVCC token Status Codes: 201 Created – Document created and stored on disk 202 Accepted – Document data accepted, but not yet stored on disk 400 Bad Request – Invalid request body or parameters 401 Unauthorized – Write privileges required 404 Not Found – Specified database or document ID doesn’t exists 409 Conflict – Document with the specified ID already exists or specified revision is not latest for target document
body, commandHandler, handlerException, method, url
HTTP_ACCEPTED, HTTP_BAD_REQUEST, HTTP_CREATED, HTTP_EXPECTATION_FAILED, HTTP_NO_CONTENT, HTTP_NOT_FOUND, HTTP_NOT_MODIFIED, HTTP_OK, HTTP_RESET_CONTENT
Constructor and Description |
---|
AddCommand(HttpBuilder httpBuilder,
Queryable queryable) |
Modifier and Type | Method and Description |
---|---|
HttpMethod |
asPost() |
HttpMethod |
asPut() |
<T> T |
execute()
Execute the database statement could be a
Command or a Query |
String |
getBody() |
asDelete, asGet, asHead, errorFormat, getContentEncode, getContentType, getEntity, getRevision, injectAutoIdentity, injectIdentity, isAccepted, isCreated, isExpectationFailed, isNotFound, isOk, printRequest, printResponse, setBookmark, with, with, with
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asDelete, asGet, asHead
public AddCommand(HttpBuilder httpBuilder, Queryable queryable)
public <T> T execute()
Command
Command
or a Query
public String getBody()
getBody
in interface CouchCommand
public HttpMethod asPut()
asPut
in interface CouchCommand
asPut
in class AbstractCommand
public HttpMethod asPost()
asPost
in interface CouchCommand
asPost
in class AbstractCommand
Copyright © 2012–2020 jkniv, copyleft code. All rights reserved.