diff --git a/Documentation/ImplementorManual/RestDocument.md b/Documentation/ImplementorManual/RestDocument.md index 51a75a7faa..ceb9b0b5cd 100644 --- a/Documentation/ImplementorManual/RestDocument.md +++ b/Documentation/ImplementorManual/RestDocument.md @@ -48,34 +48,46 @@ The basic operations (create, read, update, delete) for documents are mapped to the standard HTTP methods (`POST`, `GET`, `PUT`, `DELETE`). There is also a partial update method, which is mapped to the HTTP `PATCH` method. -An identifier for the document revision is returned in the `ETag` header field. +An identifier for the document revision is returned in the `ETag` HTTP header. If you modify a document, you can use the `If-Match` field to detect conflicts. The revision of a document can be checking using the HTTP method `HEAD`. Address and ETag of a Document {#RestDocumentResource} ====================================================== -All documents in ArangoDB have a document handle. This handle uniquely defines a -document and is managed by ArangoDB. All documents are found under the URI: +All documents in ArangoDB have a document handle. This handle uniquely identifies +a document. Any document can be retrieved using its unique URI: - http://server:port/_api/document/document-handle + http://server:port/_api/document/ -For example: Assume that the document handle, which is stored in the `_id` +For example, assumed that the document handle, which is stored in the `_id` attribute of the document, is `demo/362549736`, then the URL of that document is: http://localhost:8529/_api/document/demo/362549736 +The above URL scheme does not specify a database name explicitly, so the +default database will be used. To explicitly specify the database context, use +the following URL schema: + + http://server:port/_db//_api/document/ + +Example: + + http://localhost:8529/_db/mydb/_api/document/demo/362549736 + +Note that the following examples use the short URL format for brevity. + Each document also has a document revision or etag with is returned in the -"ETag" header field when requesting a document. +"ETag" HTTP header when requesting a document. If you obtain a document using `GET` and you want to check if a newer revision is available, then you can use the `If-None-Match` header. If the document is -unchanged, a `HTTP 412` is returned. +unchanged, a `HTTP 412` (precondition failed) error is returned. If you want to update or delete a document, then you can use the `If-Match` header. If the document has changed, then the operation is aborted and a `HTTP -412` is returned. +412` error is returned. Working with Documents using REST {#RestDocumentHttp} ===================================================== diff --git a/Documentation/ImplementorManual/RestEdge.md b/Documentation/ImplementorManual/RestEdge.md index 1641de56d8..b06b20cdae 100644 --- a/Documentation/ImplementorManual/RestEdge.md +++ b/Documentation/ImplementorManual/RestEdge.md @@ -31,20 +31,33 @@ Documents, Identifiers, Handles {#RestEdgeIntro} Address and ETag of an Edge {#RestEdgeResource} =============================================== -All documents in ArangoDB have a document handle. This handle uniquely defines a -document and is managed by ArangoDB. All documents are found under the URI +All documents in ArangoDB have a document handle. This handle uniquely identifies +a document. Any document can be retrieved using its unique URI: - http://server:port/_api/document/document-handle + http://server:port/_api/document/ -For edges you can use the special address +Edges are a special variation of documents, and to work with edges, the above URL +format changes to: - http://server:port/_api/edge/document-handle + http://server:port/_api/edge/ -For example: Assume that the document handle, which is stored in the `_id` +For example, assumed that the document handle, which is stored in the `_id` attribute of the edge, is `demo/362549736`, then the URL of that edge is: http://localhost:8529/_api/edge/demo/362549736 +The above URL scheme does not specify a database name explicitly, so the +default database will be used. To explicitly specify the database context, use +the following URL schema: + + http://server:port/_db//_api/edge/ + +Example: + + http://localhost:8529/_db/mydb/_api/edge/demo/362549736 + +Note that the following examples use the short URL format for brevity. + Working with Edges using REST {#RestEdgeHttp} =============================================