mirror of https://gitee.com/bigwinds/arangodb
renamed /document to /_api/document, /edge to /_api/edge
This commit is contained in:
parent
47aa592fc1
commit
3daeecc700
|
@ -1,9 +1,9 @@
|
|||
> curl --data @- -X POST --dump - http://localhost:8529/document?collection=73482
|
||||
> curl --data @- -X POST --dump - http://localhost:8529/_api/document?collection=73482
|
||||
{ "Hallo" : "World" }
|
||||
|
||||
HTTP/1.1 201 Created
|
||||
content-type: application/json; charset=utf-8
|
||||
location: /document/73482/26445614
|
||||
location: /_api/document/73482/26445614
|
||||
etag: "26445614"
|
||||
|
||||
{
|
|
@ -1,9 +1,9 @@
|
|||
> curl --data @- -X POST --dump - http://localhost:8529/document?collection=2957066
|
||||
> curl --data @- -X POST --dump - http://localhost:8529/_api/document?collection=2957066
|
||||
{ "Hallo" : "World" }
|
||||
|
||||
HTTP/1.1 202 Accepted
|
||||
content-type: application/json; charset=utf-8
|
||||
location: /document/2957066/26576686
|
||||
location: /_api/document/2957066/26576686
|
||||
etag: "26576686"
|
||||
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
> curl --data @- -X POST --dump - http://localhost:8529/document?collection=73482
|
||||
> curl --data @- -X POST --dump - http://localhost:8529/_api/document?collection=73482
|
||||
{ 1 : 2 }
|
||||
|
||||
HTTP/1.1 400 Bad Request
|
|
@ -1,4 +1,4 @@
|
|||
> curl --data @- -X POST --dump - http://localhost:8529/document?collection=UnitTestsCollectionNamed1332797687&createCollection=true
|
||||
> curl --data @- -X POST --dump - http://localhost:8529/_api/document?collection=example&createCollection=true
|
||||
{ "Hallo" : "World" }
|
||||
|
||||
HTTP/1.1 202 Accepted
|
|
@ -1,9 +1,9 @@
|
|||
> curl --data @- -X POST --dump - http://localhost:8529/document?collection=UnitTestsCollectionBasics
|
||||
> curl --data @- -X POST --dump - http://localhost:8529/_api/document?collection=example
|
||||
{ "Hallo" : "World" }
|
||||
|
||||
HTTP/1.1 201 Created
|
||||
content-type: application/json; charset=utf-8
|
||||
location: /document/73482/26707758
|
||||
location: /_api/document/73482/26707758
|
||||
etag: "26707758"
|
||||
|
||||
{
|
|
@ -1,9 +1,9 @@
|
|||
> curl --data @- -X POST --dump - http://localhost:8529/document?collection=NewCollection&createCollection=true
|
||||
> curl --data @- -X POST --dump - http://localhost:8529/_api/document?collection=NewCollection&createCollection=true
|
||||
{ "Hallo" : "World" }
|
||||
|
||||
HTTP/1.1 202 Accepted
|
||||
content-type: application/json; charset=utf-8
|
||||
location: /document/33652169/35159497
|
||||
location: /_api/document/33652169/35159497
|
||||
etag: "35159497"
|
||||
|
||||
{
|
|
@ -0,0 +1,12 @@
|
|||
> curl --data @- -X POST --dump - http://localhost:8529/_api/document?collection=123456
|
||||
{}
|
||||
|
||||
HTTP/1.1 404 Not Found
|
||||
content-type: application/json; charset=utf-8
|
||||
|
||||
{
|
||||
"errorMessage": "collection /_api/collection/123456 not found",
|
||||
"errorNum": 1203,
|
||||
"code": 404,
|
||||
"error": true
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
> curl -X DELETE --dump - http://localhost:8529/document/73482/30967598
|
||||
> curl -X DELETE --dump - http://localhost:8529/_api/document/73482/30967598
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
content-type: application/json; charset=utf-8
|
|
@ -1,4 +1,4 @@
|
|||
> curl -X DELETE '-H if-match: "31098669"' --dump - http://localhost:8529/document/73482/31098670
|
||||
> curl -X DELETE '-H if-match: "31098669"' --dump - http://localhost:8529/_api/document/73482/31098670
|
||||
|
||||
HTTP/1.1 412 Precondition Failed
|
||||
content-type: application/json; charset=utf-8
|
|
@ -0,0 +1,11 @@
|
|||
> curl -X DELETE --dump - http://localhost:8529/_api/document/73482/234567
|
||||
|
||||
HTTP/1.1 404 Not Found
|
||||
content-type: application/json; charset=utf-8
|
||||
|
||||
{
|
||||
"errorMessage": "document /_api/document/73482/234567 not found",
|
||||
"errorNum": 1202,
|
||||
"code": 404,
|
||||
"error": true
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
> curl --data @- -X POST --dump - http://localhost:8529/_api/edge?collection=7848004&from=7848004/9289796&to=7848004/9355332
|
||||
{ "e" : 1 }
|
||||
|
||||
HTTP/1.1 201 Created
|
||||
content-type: application/json; charset=utf-8
|
||||
location: /_api/document/7848004/9683012
|
||||
etag: "9683012"
|
||||
|
||||
{
|
||||
"_rev": 9683012,
|
||||
"_id": "7848004/9683012",
|
||||
"error": false
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
> curl -X GET --dump - http://localhost:8529/edge/7848004/9683012
|
||||
> curl -X GET --dump - http://localhost:8529/_api/edge/7848004/9683012
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
content-type: application/json; charset=utf-8
|
|
@ -1,4 +1,4 @@
|
|||
> curl -X GET --dump - http://localhost:8529/edges/17501660?vertex=17501660/18419164
|
||||
> curl -X GET --dump - http://localhost:8529/_api/edges/17501660?vertex=17501660/18419164
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
content-type: application/json
|
|
@ -1,4 +1,4 @@
|
|||
> curl -X GET --dump - http://localhost:8529/edges/17501660?vertex=17501660/18419164&direction=in
|
||||
> curl -X GET --dump - http://localhost:8529/_api/edges/17501660?vertex=17501660/18419164&direction=in
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
content-type: application/json
|
|
@ -1,4 +1,4 @@
|
|||
> curl -X GET --dump - http://localhost:8529/edges/17501660?vertex=17501660/18419164&direction=out
|
||||
> curl -X GET --dump - http://localhost:8529/_api/edges/17501660?vertex=17501660/18419164&direction=out
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
content-type: application/json
|
|
@ -1,4 +1,4 @@
|
|||
> curl -X GET --dump - http://localhost:8529/document/73482/28411694
|
||||
> curl -X GET --dump - http://localhost:8529/_api/document/73482/28411694
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
content-type: application/json; charset=utf-8
|
|
@ -1,4 +1,4 @@
|
|||
> curl -X GET --dump - http://localhost:8529/document?collection=6627082
|
||||
> curl -X GET --dump - http://localhost:8529/_api/document?collection=6627082
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
content-type: application/json; charset=utf-8
|
|
@ -1,4 +1,4 @@
|
|||
> curl -X HEAD --dump - http://localhost:8529/document/73482/29591342
|
||||
> curl -X HEAD --dump - http://localhost:8529/_api/document/73482/29591342
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
content-type: application/json; charset=utf-8
|
|
@ -1,4 +1,4 @@
|
|||
> curl -X GET '-H if-none-match: "28542766"' --dump - http://localhost:8529/document/73482/28542766
|
||||
> curl -X GET '-H if-none-match: "28542766"' --dump - http://localhost:8529/_api/document/73482/28542766
|
||||
|
||||
HTTP/1.1 304 Not Modified
|
||||
content-type: text/plain;charset=utf-8
|
|
@ -0,0 +1,11 @@
|
|||
> curl -X GET --dump - http://localhost:8529/_api/document/73482/234567
|
||||
|
||||
HTTP/1.1 404 Not Found
|
||||
content-type: application/json; charset=utf-8
|
||||
|
||||
{
|
||||
"errorMessage": "document /_api/document/73482/234567 not found",
|
||||
"errorNum": 1202,
|
||||
"code": 404,
|
||||
"error": true
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
> curl --data @- -X PUT --dump - http://localhost:8529/document/73482/29853486
|
||||
> curl --data @- -X PUT --dump - http://localhost:8529/_api/document/73482/29853486
|
||||
{ "World" : "Hallo" }
|
||||
|
||||
HTTP/1.1 200 OK
|
|
@ -1,4 +1,4 @@
|
|||
> curl --data @- -X PUT '-H if-match: "30050093"' --dump - http://localhost:8529/document/73482/30050094
|
||||
> curl --data @- -X PUT '-H if-match: "30050093"' --dump - http://_api/localhost:8529/document/73482/30050094
|
||||
{ "World" : "Hallo" }
|
||||
|
||||
HTTP/1.1 412 Precondition Failed
|
|
@ -1,4 +1,4 @@
|
|||
> curl --data @- -X PUT '-H if-match: "30246701"' --dump - http://localhost:8529/document/73482/30246702?policy=last
|
||||
> curl --data @- -X PUT '-H if-match: "30246701"' --dump - http://localhost:8529/_api/document/73482/30246702?policy=last
|
||||
{ "World" : "Hallo" }
|
||||
|
||||
HTTP/1.1 200 OK
|
|
@ -1,4 +1,4 @@
|
|||
> curl --data @- -X PUT --dump - http://localhost:8529/document/73482/30443310?rev=30443309
|
||||
> curl --data @- -X PUT --dump - http://localhost:8529/_api/document/73482/30443310?rev=30443309
|
||||
{ "World" : "Hallo" }
|
||||
|
||||
HTTP/1.1 412 Precondition Failed
|
|
@ -0,0 +1,12 @@
|
|||
> curl --data @- -X PUT --dump - http://localhost:8529/_api/document/73482/234567
|
||||
{}
|
||||
|
||||
HTTP/1.1 404 Not Found
|
||||
content-type: application/json; charset=utf-8
|
||||
|
||||
{
|
||||
"errorMessage": "document /_api/document/73482/234567 not found",
|
||||
"errorNum": 1202,
|
||||
"code": 404,
|
||||
"error": true
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
> curl --data @- -X POST --dump - http://localhost:8529/document?collection=123456
|
||||
{}
|
||||
|
||||
HTTP/1.1 404 Not Found
|
||||
content-type: application/json; charset=utf-8
|
||||
|
||||
{
|
||||
"errorMessage": "collection /collection/123456 not found",
|
||||
"errorNum": 1203,
|
||||
"code": 404,
|
||||
"error": true
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
> curl -X DELETE --dump - http://localhost:8529/document/73482/234567
|
||||
|
||||
HTTP/1.1 404 Not Found
|
||||
content-type: application/json; charset=utf-8
|
||||
|
||||
{
|
||||
"errorMessage": "document /document/73482/234567 not found",
|
||||
"errorNum": 1202,
|
||||
"code": 404,
|
||||
"error": true
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
> curl --data @- -X POST --dump - http://localhost:8529/edge?collection=7848004&from=7848004/9289796&to=7848004/9355332
|
||||
{ "e" : 1 }
|
||||
|
||||
HTTP/1.1 201 Created
|
||||
content-type: application/json; charset=utf-8
|
||||
location: /document/7848004/9683012
|
||||
etag: "9683012"
|
||||
|
||||
{
|
||||
"_rev": 9683012,
|
||||
"_id": "7848004/9683012",
|
||||
"error": false
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
> curl -X GET --dump - http://localhost:8529/document/73482/234567
|
||||
|
||||
HTTP/1.1 404 Not Found
|
||||
content-type: application/json; charset=utf-8
|
||||
|
||||
{
|
||||
"errorMessage": "document /document/73482/234567 not found",
|
||||
"errorNum": 1202,
|
||||
"code": 404,
|
||||
"error": true
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
> curl --data @- -X PUT --dump - http://localhost:8529/document/73482/234567
|
||||
{}
|
||||
|
||||
HTTP/1.1 404 Not Found
|
||||
content-type: application/json; charset=utf-8
|
||||
|
||||
{
|
||||
"errorMessage": "document /document/73482/234567 not found",
|
||||
"errorNum": 1202,
|
||||
"code": 404,
|
||||
"error": true
|
||||
}
|
|
@ -156,9 +156,9 @@ HttpHandler::status_e RestDocumentHandler::execute () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates a document
|
||||
///
|
||||
/// @RESTHEADER{POST /document,creates a document}
|
||||
/// @RESTHEADER{POST /_api/document,creates a document}
|
||||
///
|
||||
/// @REST{POST /document?collection=@FA{collection-identifier}}
|
||||
/// @REST{POST /_api/document?collection=@FA{collection-identifier}}
|
||||
///
|
||||
/// Creates a new document in the collection identified by the
|
||||
/// @FA{collection-identifier}. A JSON representation of the document must be
|
||||
|
@ -183,15 +183,12 @@ HttpHandler::status_e RestDocumentHandler::execute () {
|
|||
/// then a @LIT{HTTP 400} is returned and the body of the response contains
|
||||
/// an error document.
|
||||
///
|
||||
/// @REST{POST /document?collection=@FA{collection-name}@LATEXBREAK&createCollection=@FA{create}}
|
||||
/// @REST{POST /_api/document?collection=@FA{collection-name}@LATEXBREAK&createCollection=@FA{create}}
|
||||
///
|
||||
/// Instead of a @FA{collection-identifier}, a @FA{collection-name} can be
|
||||
/// used. If @FA{createCollection} is true, then the collection is created if it
|
||||
/// does not exists.
|
||||
///
|
||||
/// @note If you are implementing a client api, then you should use the
|
||||
/// alternative path @LIT{/_api/document}.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// Create a document given a collection identifier @LIT{161039} for the collection
|
||||
|
@ -199,27 +196,27 @@ HttpHandler::status_e RestDocumentHandler::execute () {
|
|||
/// the last part of the document handle. It generally will be equal, but there is
|
||||
/// no guaranty.
|
||||
///
|
||||
/// @EXAMPLE{rest_create-document,create a document}
|
||||
/// @EXAMPLE{rest-create-document,create a document}
|
||||
///
|
||||
/// Create a document in a collection where @LIT{waitForSync} is @LIT{false}.
|
||||
///
|
||||
/// @EXAMPLE{rest_create-document-accept,accept a document}
|
||||
/// @EXAMPLE{rest-create-document-accept,accept a document}
|
||||
///
|
||||
/// Create a document in a known, named collection
|
||||
///
|
||||
/// @verbinclude rest_create-document-named-collection
|
||||
/// @verbinclude rest-create-document-named-collection
|
||||
///
|
||||
/// Create a document in a new, named collection
|
||||
///
|
||||
/// @verbinclude rest_create-document-create-collection
|
||||
/// @verbinclude rest-create-document-create-collection
|
||||
///
|
||||
/// Unknown collection identifier:
|
||||
///
|
||||
/// @verbinclude rest_create-document-unknown-cid
|
||||
/// @verbinclude rest-create-document-unknown-cid
|
||||
///
|
||||
/// Illegal document:
|
||||
///
|
||||
/// @verbinclude rest_create-document-bad-json
|
||||
/// @verbinclude rest-create-document-bad-json
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool RestDocumentHandler::createDocument () {
|
||||
|
@ -334,7 +331,7 @@ bool RestDocumentHandler::readDocument () {
|
|||
case 1:
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_ARANGO_DOCUMENT_HANDLE_BAD,
|
||||
"expecting GET /document/<document-handle>");
|
||||
"expecting GET /_api/document/<document-handle>");
|
||||
return false;
|
||||
|
||||
case 2:
|
||||
|
@ -343,7 +340,7 @@ bool RestDocumentHandler::readDocument () {
|
|||
default:
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_SUPERFLUOUS_SUFFICES,
|
||||
"expecting GET /document/<document-handle> or GET /document?collection=<collection-identifier>");
|
||||
"expecting GET /_api/document/<document-handle> or GET /_api/document?collection=<collection-identifier>");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -351,9 +348,9 @@ bool RestDocumentHandler::readDocument () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief reads a single document
|
||||
///
|
||||
/// @RESTHEADER{GET /document,reads a document}
|
||||
/// @RESTHEADER{GET /_api/document,reads a document}
|
||||
///
|
||||
/// @REST{GET /document/@FA{document-handle}}
|
||||
/// @REST{GET /_api/document/@FA{document-handle}}
|
||||
///
|
||||
/// Returns the document identified by @FA{document-handle}. The returned
|
||||
/// document contains two special attributes: @LIT{_id} containing the document
|
||||
|
@ -374,22 +371,19 @@ bool RestDocumentHandler::readDocument () {
|
|||
/// given etag. Otherwise a @LIT{HTTP 412} is returned. As an alternative
|
||||
/// you can supply the etag in an attribute @LIT{rev} in the URL.
|
||||
///
|
||||
/// @note If you are implementing a client api, then you should use the
|
||||
/// alternative path @LIT{/_api/document}.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// Use a document handle:
|
||||
///
|
||||
/// @verbinclude rest_read-document
|
||||
/// @verbinclude rest-read-document
|
||||
///
|
||||
/// Use a document handle and an etag:
|
||||
///
|
||||
/// @verbinclude rest_read-document-if-none-match
|
||||
/// @verbinclude rest-read-document-if-none-match
|
||||
///
|
||||
/// Unknown document handle:
|
||||
///
|
||||
/// @verbinclude rest_read-document-unknown-handle
|
||||
/// @verbinclude rest-read-document-unknown-handle
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool RestDocumentHandler::readSingleDocument (bool generateBody) {
|
||||
|
@ -477,21 +471,18 @@ bool RestDocumentHandler::readSingleDocument (bool generateBody) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief reads all documents
|
||||
///
|
||||
/// @RESTHEADER{GET /document,reads all document}
|
||||
/// @RESTHEADER{GET /_api/document,reads all document}
|
||||
///
|
||||
/// @REST{GET /document?collection=@FA{collection-identifier}}
|
||||
/// @REST{GET /_api/document?collection=@FA{collection-identifier}}
|
||||
///
|
||||
/// Returns a list of all URI for all documents from the collection identified
|
||||
/// by @FA{collection-identifier}.
|
||||
///
|
||||
/// Instead of a @FA{collection-identifier}, a collection name can be given.
|
||||
///
|
||||
/// @note If you are implementing a client api, then you should use the
|
||||
/// alternative path @LIT{/_api/document}.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @verbinclude rest_read-document-all
|
||||
/// @verbinclude rest-read-document-all
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool RestDocumentHandler::readAllDocuments () {
|
||||
|
@ -586,20 +577,17 @@ bool RestDocumentHandler::readAllDocuments () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief reads a single document head
|
||||
///
|
||||
/// @RESTHEADER{HEAD /document,reads a document header}
|
||||
/// @RESTHEADER{HEAD /_api/document,reads a document header}
|
||||
///
|
||||
/// @REST{HEAD /document/@FA{document-handle}}
|
||||
/// @REST{HEAD /_api/document/@FA{document-handle}}
|
||||
///
|
||||
/// Like @FN{GET}, but only returns the header fields and not the body. You
|
||||
/// can use this call to get the current revision of a document or check if
|
||||
/// the document was deleted.
|
||||
///
|
||||
/// @note If you are implementing a client api, then you should use the
|
||||
/// alternative path @LIT{/_api/document}.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @verbinclude rest_read-document-head
|
||||
/// @verbinclude rest-read-document-head
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool RestDocumentHandler::checkDocument () {
|
||||
|
@ -608,7 +596,7 @@ bool RestDocumentHandler::checkDocument () {
|
|||
if (suffix.size() != 2) {
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_BAD_PARAMETER,
|
||||
"expecting URI /document/<document-handle>");
|
||||
"expecting URI /_api/document/<document-handle>");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -618,9 +606,9 @@ bool RestDocumentHandler::checkDocument () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief updates a document
|
||||
///
|
||||
/// @RESTHEADER{PUT /document,updates a document}
|
||||
/// @RESTHEADER{PUT /_api/document,updates a document}
|
||||
///
|
||||
/// @REST{PUT /document/@FA{document-handle}}
|
||||
/// @REST{PUT /_api/document/@FA{document-handle}}
|
||||
///
|
||||
/// Updates the document identified by @FA{document-handle}. If the document exists
|
||||
/// and can be updated, then a @LIT{HTTP 201} is returned and the "ETag" header
|
||||
|
@ -645,41 +633,38 @@ bool RestDocumentHandler::checkDocument () {
|
|||
/// mismatch, then a @LIT{HTTP 409} conflict is returned and no update is
|
||||
/// performed.
|
||||
///
|
||||
/// @REST{PUT /document/@FA{document-handle}?policy=@FA{policy}}
|
||||
/// @REST{PUT /_api/document/@FA{document-handle}?policy=@FA{policy}}
|
||||
///
|
||||
/// As before, if @FA{policy} is @LIT{error}. If @FA{policy} is @LIT{last},
|
||||
/// then the last write will win.
|
||||
///
|
||||
/// @REST{PUT /document/@FA{collection-identifier}/@FA{document-identifier}?rev=@FA{etag}}
|
||||
/// @REST{PUT /_api/document/@FA{collection-identifier}/@FA{document-identifier}?rev=@FA{etag}}
|
||||
///
|
||||
/// You can also supply the etag using the parameter @LIT{rev} instead of an "ETag"
|
||||
/// header. You must never supply both the "ETag" header and the @LIT{rev}
|
||||
/// parameter.
|
||||
///
|
||||
/// @note If you are implementing a client api, then you should use the
|
||||
/// alternative path @LIT{/_api/document}.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// Using document handle:
|
||||
///
|
||||
/// @verbinclude rest_update-document
|
||||
/// @verbinclude rest-update-document
|
||||
///
|
||||
/// Unknown document handle:
|
||||
///
|
||||
/// @verbinclude rest_update-document-unknown-handle
|
||||
/// @verbinclude rest-update-document-unknown-handle
|
||||
///
|
||||
/// Produce a revision conflict:
|
||||
///
|
||||
/// @verbinclude rest_update-document-if-match-other
|
||||
/// @verbinclude rest-update-document-if-match-other
|
||||
///
|
||||
/// Last write wins:
|
||||
///
|
||||
/// @verbinclude rest_update-document-if-match-other-last-write
|
||||
/// @verbinclude rest-update-document-if-match-other-last-write
|
||||
///
|
||||
/// Alternative to header field:
|
||||
///
|
||||
/// @verbinclude rest_update-document-rev-other
|
||||
/// @verbinclude rest-update-document-rev-other
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool RestDocumentHandler::updateDocument () {
|
||||
|
@ -688,7 +673,7 @@ bool RestDocumentHandler::updateDocument () {
|
|||
if (suffix.size() != 2) {
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_BAD_PARAMETER,
|
||||
"expecting UPDATE /document/<document-handle>");
|
||||
"expecting UPDATE /_api/document/<document-handle>");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -781,9 +766,9 @@ bool RestDocumentHandler::updateDocument () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief deletes a document
|
||||
///
|
||||
/// @RESTHEADER{DELETE /document,deletes a document}
|
||||
/// @RESTHEADER{DELETE /_api/document,deletes a document}
|
||||
///
|
||||
/// @REST{DELETE /document/@FA{document-handle}}
|
||||
/// @REST{DELETE /_api/document/@FA{document-handle}}
|
||||
///
|
||||
/// Deletes the document identified by @FA{document-handle}. If the document
|
||||
/// exists and could be deleted, then a @LIT{HTTP 204} is returned.
|
||||
|
@ -801,33 +786,30 @@ bool RestDocumentHandler::updateDocument () {
|
|||
/// mismatch, then a @LIT{HTTP 412} conflict is returned and no delete is
|
||||
/// performed.
|
||||
///
|
||||
/// @REST{DELETE /document/@FA{document-handle}?policy=@FA{policy}}
|
||||
/// @REST{DELETE /_api/document/@FA{document-handle}?policy=@FA{policy}}
|
||||
///
|
||||
/// As before, if @FA{policy} is @LIT{error}. If @FA{policy} is @LIT{last}, then
|
||||
/// the last write will win.
|
||||
///
|
||||
/// @REST{DELETE /document/@FA{document-handle}?rev=@FA{etag}}
|
||||
/// @REST{DELETE /_api/document/@FA{document-handle}?rev=@FA{etag}}
|
||||
///
|
||||
/// You can also supply the etag using the parameter @LIT{rev} instead of an
|
||||
/// "If-Match" header. You must never supply both the "If-Match" header and the
|
||||
/// @LIT{rev} parameter.
|
||||
///
|
||||
/// @note If you are implementing a client api, then you should use the
|
||||
/// alternative path @LIT{/_api/document}.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// Using document handle:
|
||||
///
|
||||
/// @verbinclude rest_delete-document
|
||||
/// @verbinclude rest-delete-document
|
||||
///
|
||||
/// Unknown document handle:
|
||||
///
|
||||
/// @verbinclude rest_delete-document-unknown-handle
|
||||
/// @verbinclude rest-delete-document-unknown-handle
|
||||
///
|
||||
/// Revision conflict:
|
||||
///
|
||||
/// @verbinclude rest_delete-document-if-match-other
|
||||
/// @verbinclude rest-delete-document-if-match-other
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool RestDocumentHandler::deleteDocument () {
|
||||
|
@ -836,7 +818,7 @@ bool RestDocumentHandler::deleteDocument () {
|
|||
if (suffix.size() != 2) {
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_BAD_PARAMETER,
|
||||
"expecting DELETE /document/<document-handle>");
|
||||
"expecting DELETE /_api/document/<document-handle>");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,9 +70,9 @@ RestEdgeHandler::RestEdgeHandler (HttpRequest* request, TRI_vocbase_t* vocbase)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates an edge
|
||||
///
|
||||
/// @RESTHEADER{POST /edge,creates an edge}
|
||||
/// @RESTHEADER{POST /_api/edge,creates an edge}
|
||||
///
|
||||
/// @REST{POST /edge?collection=@FA{collection-identifier}&from=@FA{from-handle}&to=@FA{to-handle}}
|
||||
/// @REST{POST /_api/edge?collection=@FA{collection-identifier}&from=@FA{from-handle}&to=@FA{to-handle}}
|
||||
///
|
||||
/// Creates a new edge in the collection identified by the
|
||||
/// @FA{collection-identifier}. A JSON representation of the document must be
|
||||
|
@ -86,18 +86,15 @@ RestEdgeHandler::RestEdgeHandler (HttpRequest* request, TRI_vocbase_t* vocbase)
|
|||
/// If you request such an edge, the returned document will also contain the
|
||||
/// attributes @LIT{_from} and @LIT{_to}.
|
||||
///
|
||||
/// @note If you are implementing a client api then you should use the path
|
||||
/// @LIT{/_api/document}.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// Create an edge:
|
||||
///
|
||||
/// @verbinclude rest_edge-create-edge
|
||||
/// @verbinclude rest-edge-create-edge
|
||||
///
|
||||
/// Read an edge:
|
||||
///
|
||||
/// @verbinclude rest_edge-read-edge
|
||||
/// @verbinclude rest-edge-read-edge
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool RestEdgeHandler::createDocument () {
|
||||
|
|
|
@ -81,19 +81,19 @@ LoggerData::Extra const RestVocbaseBaseHandler::RES_FAIL;
|
|||
/// @brief document path
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
string RestVocbaseBaseHandler::DOCUMENT_PATH = "/document";
|
||||
string RestVocbaseBaseHandler::DOCUMENT_PATH = "/_api/document";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief document path
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
string RestVocbaseBaseHandler::EDGE_PATH = "/edge";
|
||||
string RestVocbaseBaseHandler::EDGE_PATH = "/_api/edge";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief collection path
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
string RestVocbaseBaseHandler::COLLECTION_PATH = "/collection";
|
||||
string RestVocbaseBaseHandler::COLLECTION_PATH = "/_api/collection";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief documents import path
|
||||
|
|
|
@ -45,12 +45,12 @@
|
|||
/// @page RestDocumentCallsTOC
|
||||
///
|
||||
/// <ul>
|
||||
/// <li>@ref RestDocumentRead "GET /document/document-handle"</li>
|
||||
/// <li>@ref RestDocumentCreate "POST /document?collection=collection-identifier"</li>
|
||||
/// <li>@ref RestDocumentUpdate "PUT /document/document-handle"</li>
|
||||
/// <li>@ref RestDocumentDelete "DELETE /document/document-handle"</li>
|
||||
/// <li>@ref RestDocumentHead "HEAD /document/document-handle"</li>
|
||||
/// <li>@ref RestDocumentReadAll "GET /document?collection=collection-identifier"</li>
|
||||
/// <li>@ref RestDocumentRead "GET /_api/document/document-handle"</li>
|
||||
/// <li>@ref RestDocumentCreate "POST /_api/document?collection=collection-identifier"</li>
|
||||
/// <li>@ref RestDocumentUpdate "PUT /_api/document/document-handle"</li>
|
||||
/// <li>@ref RestDocumentDelete "DELETE /_api/document/document-handle"</li>
|
||||
/// <li>@ref RestDocumentHead "HEAD /_api/document/document-handle"</li>
|
||||
/// <li>@ref RestDocumentReadAll "GET /_api/document?collection=collection-identifier"</li>
|
||||
/// </ul>
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -97,13 +97,13 @@
|
|||
/// defines a document and is managed by ArangoDB. All documents are
|
||||
/// found under the URI:
|
||||
///
|
||||
/// @LIT{http://@FA{server}:@FA{port}/document/@FA{document-handle}}
|
||||
/// @LIT{http://@FA{server}:@FA{port}/_api/document/@FA{document-handle}}
|
||||
///
|
||||
/// For example: Assume that the document handle, which is stored in
|
||||
/// the @LIT{_id} field of the document, is @LIT{7254820/362549736},
|
||||
/// then the URL of that document is:
|
||||
///
|
||||
/// @LIT{http://localhost:8529/document/7254820/362549736}
|
||||
/// @LIT{http://localhost:8529/_api/document/7254820/362549736}
|
||||
///
|
||||
/// Each document also has a document revision or etag with is returned
|
||||
/// in the "ETag" header field when requesting a document.
|
||||
|
|
|
@ -45,12 +45,12 @@
|
|||
/// @page RestEdgeCallsTOC
|
||||
///
|
||||
/// <ul>
|
||||
/// <li>@ref RestEdgeRead "GET /edge/document-handle"</li>
|
||||
/// <li>@ref RestEdgeCreate "POST /edge?collection=collection-identifier&from=from-handle&to=to-handle"</li>
|
||||
/// <li>@ref RestEdgeUpdate "PUT /edge/document-handle"</li>
|
||||
/// <li>@ref RestEdgeDelete "DELETE /edge/document-handle"</li>
|
||||
/// <li>@ref RestEdgeHead "HEAD /edge/document-handle"</li>
|
||||
/// <li>@ref RestEdgeEdges "GET /edges/collection-identifier?vertex=vertex-handle&directory=direction"</li>
|
||||
/// <li>@ref RestEdgeRead "GET /_api/edge/document-handle"</li>
|
||||
/// <li>@ref RestEdgeCreate "POST /_api/edge?collection=collection-identifier&from=from-handle&to=to-handle"</li>
|
||||
/// <li>@ref RestEdgeUpdate "PUT /_api/edge/document-handle"</li>
|
||||
/// <li>@ref RestEdgeDelete "DELETE /_api/edge/document-handle"</li>
|
||||
/// <li>@ref RestEdgeHead "HEAD /_api/edge/document-handle"</li>
|
||||
/// <li>@ref RestEdgeEdges "GET /_api/edges/collection-identifier?vertex=vertex-handle&directory=direction"</li>
|
||||
/// </ul>
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -93,26 +93,26 @@
|
|||
/// defines a document and is managed by ArangoDB. All documents are
|
||||
/// found under the URI
|
||||
///
|
||||
/// @LIT{http://@FA{server}:@FA{port}/document/@FA{document-handle}}
|
||||
/// @LIT{http://@FA{server}:@FA{port}/_api/document/@FA{document-handle}}
|
||||
///
|
||||
/// For edges you can use the special address
|
||||
///
|
||||
/// @LIT{http://@FA{server}:@FA{port}/edge/@FA{document-handle}}
|
||||
/// @LIT{http://@FA{server}:@FA{port}/_api/edge/@FA{document-handle}}
|
||||
///
|
||||
/// For example: Assume that the document handle, which is stored in
|
||||
/// the @LIT{_id} field of the edge, is @LIT{7254820/362549736},
|
||||
/// then the URL of that edge is:
|
||||
///
|
||||
/// @LIT{http://localhost:8529/edge/7254820/362549736}
|
||||
/// @LIT{http://localhost:8529/_api/edge/7254820/362549736}
|
||||
///
|
||||
/// @section RestEdgeHttp Working with Edges using REST
|
||||
///////////////////////////////////////////////////////
|
||||
///
|
||||
/// @anchor RestEdgeRead
|
||||
////////////////////////
|
||||
/// @RESTHEADER{GET /edge,reads an edge}
|
||||
/// @RESTHEADER{GET /_api/edge,reads an edge}
|
||||
///
|
||||
/// @REST{GET /edge/@FA{document-handle}}
|
||||
/// @REST{GET /_api/edge/@FA{document-handle}}
|
||||
///
|
||||
/// See @ref RestDocument for details.
|
||||
///
|
||||
|
@ -122,25 +122,25 @@
|
|||
///
|
||||
/// @anchor RestEdgeUpdate
|
||||
//////////////////////////
|
||||
/// @RESTHEADER{PUT /edge,updates an edge}
|
||||
/// @RESTHEADER{PUT /_api/edge,updates an edge}
|
||||
///
|
||||
/// @REST{PUT /edge/@FA{document-handle}}
|
||||
/// @REST{PUT /_api/edge/@FA{document-handle}}
|
||||
///
|
||||
/// See @ref RestDocument for details.
|
||||
///
|
||||
/// @anchor RestEdgeDelete
|
||||
//////////////////////////
|
||||
/// @RESTHEADER{DELETE /edge,deletes an edge}
|
||||
/// @RESTHEADER{DELETE /_api/edge,deletes an edge}
|
||||
///
|
||||
/// @REST{DELETE /edge/@FA{document-handle}}
|
||||
/// @REST{DELETE /_api/edge/@FA{document-handle}}
|
||||
///
|
||||
/// See @ref RestDocument for details.
|
||||
///
|
||||
/// @anchor RestEdgeHead
|
||||
////////////////////////
|
||||
/// @RESTHEADER{GET /edge,reads an edge header}
|
||||
/// @RESTHEADER{GET /_api/edge,reads an edge header}
|
||||
///
|
||||
/// @REST{HEAD /document/@FA{document-handle}}
|
||||
/// @REST{HEAD /_api/edge/@FA{document-handle}}
|
||||
///
|
||||
/// See @ref RestDocument for details.
|
||||
///
|
||||
|
|
|
@ -233,9 +233,6 @@ function GET_api_collections (req, res) {
|
|||
/// @REST{GET /_api/collection/@FA{collection-identifier}/properties}
|
||||
////////////////////////////////////////////////////////////////////
|
||||
///
|
||||
/// @deprecated
|
||||
/// @REST{GET /_api/collection/@FA{collection-identifier}/parameter}
|
||||
///
|
||||
/// In addition to the above, the result will always contain the
|
||||
/// @LIT{waitForSync} and the @LIT{journalSize} properties. This is
|
||||
/// achieved by forcing a load of the underlying collection.
|
||||
|
@ -500,9 +497,6 @@ function PUT_api_collection_truncate (req, res, collection) {
|
|||
///
|
||||
/// @REST{PUT /_api/collection/@FA{collection-identifier}/properties}
|
||||
///
|
||||
/// @deprecated
|
||||
/// @REST{PUT /_api/collection/@FA{collection-identifier}/parameter}
|
||||
///
|
||||
/// Changes the properties of a collection. Expects an object with the
|
||||
/// attribute(s)
|
||||
///
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var actions = require("actions");
|
||||
var API = "edges";
|
||||
var API = "/_api/edges";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoAPI
|
||||
|
@ -36,19 +36,19 @@ var API = "edges";
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief get edges
|
||||
///
|
||||
/// @RESTHEADER{GET /edges,reads in- or outbound edges}
|
||||
/// @RESTHEADER{GET /_api/edges,reads in- or outbound edges}
|
||||
///
|
||||
/// @REST{GET /edges/@FA{collection-identifier}?vertex=@FA{vertex-handle}&direction=any}
|
||||
/// @REST{GET /_api/edges/@FA{collection-identifier}?vertex=@FA{vertex-handle}&direction=any}
|
||||
///
|
||||
/// Returns the list of edges starting or ending in the vertex identified by
|
||||
/// @FA{vertex-handle}.
|
||||
///
|
||||
/// @REST{GET /edges/@FA{collection-identifier}?vertex=@FA{vertex-handle}&direction=in}
|
||||
/// @REST{GET /_api/edges/@FA{collection-identifier}?vertex=@FA{vertex-handle}&direction=in}
|
||||
///
|
||||
/// Returns the list of edges ending in the vertex identified by
|
||||
/// @FA{vertex-handle}.
|
||||
///
|
||||
/// @REST{GET /edges/@FA{collection-identifier}?vertex=@FA{vertex-handle}&direction=out}
|
||||
/// @REST{GET /_api/edges/@FA{collection-identifier}?vertex=@FA{vertex-handle}&direction=out}
|
||||
///
|
||||
/// Returns the list of edges starting in the vertex identified by
|
||||
/// @FA{vertex-handle}.
|
||||
|
@ -57,15 +57,15 @@ var API = "edges";
|
|||
///
|
||||
/// Any direction
|
||||
///
|
||||
/// @verbinclude rest_edge-read-edges-any
|
||||
/// @verbinclude rest-edge-read-edges-any
|
||||
///
|
||||
/// In edges
|
||||
///
|
||||
/// @verbinclude rest_edge-read-edges-in
|
||||
/// @verbinclude rest-edge-read-edges-in
|
||||
///
|
||||
/// Out edges
|
||||
///
|
||||
/// @verbinclude rest_edge-read-edges-out
|
||||
/// @verbinclude rest-edge-read-edges-out
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function GET_edges (req, res) {
|
||||
|
|
Loading…
Reference in New Issue