1
0
Fork 0
arangodb/js/apps/system/_admin/aardvark/APP/api-docs/batch.json

43 lines
9.1 KiB
JSON

{
"basePath": "/",
"swaggerVersion": "1.1",
"apiVersion": "0.1",
"apis": [
{
"operations": [
{
"errorResponses": [
{
"reason": "is returned if the batch was received successfully. HTTP 200 is returned even if one or multiple batch part actions failed. <br><br>",
"code": "200"
},
{
"reason": "is returned if the batch envelope is malformed or incorrectly formatted. This code will also be returned if the content-type of the overall batch request or the individual MIME parts is not as expected. <br><br>",
"code": "400"
},
{
"reason": "is returned when an invalid HTTP method is used. <br><br>",
"code": "405"
}
],
"parameters": [
{
"dataType": "String",
"paramType": "body",
"required": true,
"name": "body",
"description": "The multipart batch request, consisting of the envelope and the individual batch parts. <br><br>"
}
],
"notes": "Executes a batch request. A batch request can contain any number of other requests that can be sent to ArangoDB in isolation. The benefit of using batch requests is that batching requests requires less client/server round-trips than when sending isolated requests. <br><br> All parts of a batch request are executed serially on the server. The server will return the results of all parts in a single response when all parts are finished. <br><br> Technically, a batch request is a multipart HTTP request, with content-type <em>multipart/form-data</em>. A batch request consists of an envelope and the individual batch part actions. Batch part actions are \"regular\" HTTP requests, including full header and an optional body. Multiple batch parts are separated by a boundary identifier. The boundary identifier is declared in the batch envelope. The MIME content-type for each individual batch part must be <em>application/x-arango-batchpart</em>. <br><br> Please note that when constructing the individual batch parts, you must use CRLF (<em>\\r\\n</em>) as the line terminator as in regular HTTP messages. <br><br> The response sent by the server will be an <em>HTTP 200</em> response, with an optional error summary header <em>x-arango-errors</em>. This header contains the number of batch part operations that failed with an HTTP error code of at least 400. This header is only present in the response if the number of errors is greater than zero. <br><br> The response sent by the server is a multipart response, too. It contains the individual HTTP responses for all batch parts, including the full HTTP result header (with status code and other potential headers) and an optional result body. The individual batch parts in the result are separated using the same boundary value as specified in the request. <br><br> The order of batch parts in the response will be the same as in the original client request. Client can additionally use the <em>Content-Id</em> MIME header in a batch part to define an individual id for each batch part. The server will return this id is the batch part responses, too. <br><br>",
"summary": "executes a batch request",
"httpMethod": "POST",
"examples": "<br><br> Sending a batch request with five batch parts: <br><br> <ul class=\"swagger-list\"><li>GET /_api/version <li>DELETE /_api/collection/products <li>POST /_api/collection/products <li>GET /_api/collection/products/figures <li>DELETE /_api/collection/products </ul> The boundary (<em>SomeBoundaryValue</em>) is passed to the server in the HTTP <em>Content-Type</em> HTTP header. <br><br><br><br><pre><code class=\"json\">shell&gt; curl -X POST --header 'Content-Type: multipart/form-data; boundary=SomeBoundaryValue' --data-binary @- --dump - http://localhost:8529/_api/batch &lt;&lt;EOF\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: myId1\r\n\r\nGET /_api/version HTTP/1.1\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: myId2\r\n\r\nDELETE /_api/collection/products HTTP/1.1\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: someId\r\n\r\nPOST /_api/collection/products HTTP/1.1\r\n\r\n{ \"name\": \"products\" }\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: nextId\r\n\r\nGET /_api/collection/products/figures HTTP/1.1\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: otherId\r\n\r\nDELETE /_api/collection/products HTTP/1.1\r\n--SomeBoundaryValue--\r\n\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: multipart/form-data; boundary=SomeBoundaryValue\nx-arango-errors: 1\n\n\"--SomeBoundaryValue\\r\\nContent-Type: application/x-arango-batchpart\\r\\nContent-Id: myId1\\r\\n\\r\\nHTTP/1.1 200 OK\\r\\nContent-Type: application/json; charset=utf-8\\r\\nContent-Length: 43\\r\\n\\r\\n{\\\"server\\\":\\\"arango\\\",\\\"version\\\":\\\"2.6.0-devel\\\"}\\r\\n--SomeBoundaryValue\\r\\nContent-Type: application/x-arango-batchpart\\r\\nContent-Id: myId2\\r\\n\\r\\nHTTP/1.1 404 Not Found\\r\\nContent-Type: application/json; charset=utf-8\\r\\nContent-Length: 88\\r\\n\\r\\n{\\\"error\\\":true,\\\"code\\\":404,\\\"errorNum\\\":1203,\\\"errorMessage\\\":\\\"unknown collection 'products'\\\"}\\r\\n--SomeBoundaryValue\\r\\nContent-Type: application/x-arango-batchpart\\r\\nContent-Id: someId\\r\\n\\r\\nHTTP/1.1 200 OK\\r\\nLocation: /_db/_system/_api/collection/products\\r\\nContent-Type: application/json; charset=utf-8\\r\\nContent-Length: 138\\r\\n\\r\\n{\\\"id\\\":\\\"1642406965\\\",\\\"name\\\":\\\"products\\\",\\\"waitForSync\\\":false,\\\"isVolatile\\\":false,\\\"isSystem\\\":false,\\\"status\\\":3,\\\"type\\\":2,\\\"error\\\":false,\\\"code\\\":200}\\r\\n--SomeBoundaryValue\\r\\nContent-Type: application/x-arango-batchpart\\r\\nContent-Id: nextId\\r\\n\\r\\nHTTP/1.1 200 OK\\r\\nLocation: /_db/_system/_api/collection/products/figures\\r\\nContent-Type: application/json; charset=utf-8\\r\\nContent-Length: 618\\r\\n\\r\\n{\\\"id\\\":\\\"1642406965\\\",\\\"name\\\":\\\"products\\\",\\\"isSystem\\\":false,\\\"doCompact\\\":true,\\\"isVolatile\\\":false,\\\"journalSize\\\":1048576,\\\"keyOptions\\\":{\\\"type\\\":\\\"traditional\\\",\\\"allowUserKeys\\\":true},\\\"waitForSync\\\":false,\\\"count\\\":0,\\\"figures\\\":{\\\"alive\\\":{\\\"count\\\":0,\\\"size\\\":0},\\\"dead\\\":{\\\"count\\\":0,\\\"size\\\":0,\\\"deletion\\\":0},\\\"datafiles\\\":{\\\"count\\\":0,\\\"fileSize\\\":0},\\\"journals\\\":{\\\"count\\\":0,\\\"fileSize\\\":0},\\\"compactors\\\":{\\\"count\\\":0,\\\"fileSize\\\":0},\\\"shapefiles\\\":{\\\"count\\\":0,\\\"fileSize\\\":0},\\\"shapes\\\":{\\\"count\\\":0,\\\"size\\\":0},\\\"attributes\\\":{\\\"count\\\":0,\\\"size\\\":0},\\\"indexes\\\":{\\\"count\\\":1,\\\"size\\\":2008},\\\"lastTick\\\":\\\"0\\\",\\\"uncollectedLogfileEntries\\\":0},\\\"status\\\":3,\\\"type\\\":2,\\\"error\\\":false,\\\"code\\\":200}\\r\\n--SomeBoundaryValue\\r\\nContent-Type: application/x-arango-batchpart\\r\\nContent-Id: otherId\\r\\n\\r\\nHTTP/1.1 200 OK\\r\\nContent-Type: application/json; charset=utf-8\\r\\nContent-Length: 44\\r\\n\\r\\n{\\\"id\\\":\\\"1642406965\\\",\\\"error\\\":false,\\\"code\\\":200}\\r\\n--SomeBoundaryValue--\"\n</code></pre><br><br><br> Sending a batch request, setting the boundary implicitly (the server will in this case try to find the boundary at the beginning of the request body). <br><br><br><br><pre><code class=\"json\">shell&gt; curl -X POST --data-binary @- --dump - http://localhost:8529/_api/batch &lt;&lt;EOF\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\n\r\nDELETE /_api/collection/notexisting1 HTTP/1.1\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\n\r\nDELETE /_api/collection/notexisting2 HTTP/1.1\r\n--SomeBoundaryValue--\r\n\nEOF\n\nHTTP/1.1 200 OK\nx-arango-errors: 2\n\n\"--SomeBoundaryValue\\r\\nContent-Type: application/x-arango-batchpart\\r\\n\\r\\nHTTP/1.1 404 Not Found\\r\\nContent-Type: application/json; charset=utf-8\\r\\nContent-Length: 92\\r\\n\\r\\n{\\\"error\\\":true,\\\"code\\\":404,\\\"errorNum\\\":1203,\\\"errorMessage\\\":\\\"unknown collection 'notexisting1'\\\"}\\r\\n--SomeBoundaryValue\\r\\nContent-Type: application/x-arango-batchpart\\r\\n\\r\\nHTTP/1.1 404 Not Found\\r\\nContent-Type: application/json; charset=utf-8\\r\\nContent-Length: 92\\r\\n\\r\\n{\\\"error\\\":true,\\\"code\\\":404,\\\"errorNum\\\":1203,\\\"errorMessage\\\":\\\"unknown collection 'notexisting2'\\\"}\\r\\n--SomeBoundaryValue--\"\n</code></pre><br>",
"nickname": "executesABatchRequest"
}
],
"path": "/_api/batch"
}
]
}