{
"basePath": "/",
"swaggerVersion": "1.1",
"apiVersion": "0.1",
"apis": [
{
"operations": [
{
"errorResponses": [
{
"reason": "is returned if all documents could be imported successfully.
",
"code": "201"
},
{
"reason": "is returned if type contains an invalid value, no collection is specified, the documents are incorrectly encoded, or the request is malformed.
",
"code": "400"
},
{
"reason": "is returned if collection or the _from or _to attributes of an imported edge refer to an unknown collection.
",
"code": "404"
},
{
"reason": "is returned if the import would trigger a unique key violation and complete is set to true.
",
"code": "409"
},
{
"reason": "is returned if the server cannot auto-generate a document key (out of keys error) for a document with no user-defined key.
",
"code": "500"
}
],
"parameters": [
{
"dataType": "String",
"paramType": "body",
"required": "true",
"name": "documents",
"description": "The body must either be a JSON-encoded list of documents or a string with multiple JSON documents separated by newlines.
"
},
{
"dataType": "String",
"paramType": "query",
"required": "true",
"name": "type",
"description": "Determines how the body of the request will be interpreted. type can have the following values:
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&type=list\n[{\"_key\":\"abc\",\"value1\":25,\"value2\":\"test\",\"allowed\":true},{\"_key\":\"foo\",\"name\":\"baz\"},{\"name\":{\"detailed\":\"detailed name\",\"short\":\"short name\"}}]\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"created\" : 3, \n \"errors\" : 0, \n \"empty\" : 0 \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&type=documents\n{ \"_key\": \"abc\", \"value1\": 25, \"value2\": \"test\", \"allowed\": true }\n{ \"_key\": \"foo\", \"name\": \"baz\" }\n\n{ \"name\": { \"detailed\": \"detailed name\", \"short\": \"short name\" } }\n\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"created\" : 3, \n \"errors\" : 0, \n \"empty\" : 1 \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&type=auto\n[{\"_key\":\"abc\",\"value1\":25,\"value2\":\"test\",\"allowed\":true},{\"_key\":\"foo\",\"name\":\"baz\"},{\"name\":{\"detailed\":\"detailed name\",\"short\":\"short name\"}}]\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"created\" : 3, \n \"errors\" : 0, \n \"empty\" : 0 \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&createCollection=true&type=list\n[{\"id\":\"12553\",\"active\":true},{\"id\":\"4433\",\"active\":false},{\"id\":\"55932\",\"count\":4334}]\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"created\" : 3, \n \"errors\" : 0, \n \"empty\" : 0 \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=links&type=documents\n{ \"_from\": \"products/123\", \"_to\": \"products/234\" }\n{ \"_from\": \"products/332\", \"_to\": \"products/abc\", \"name\": \"other name\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"created\" : 2, \n \"errors\" : 0, \n \"empty\" : 0 \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=links&type=list&details=true\n[{\"name\":\"some name\"}]\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"created\" : 0, \n \"errors\" : 1, \n \"empty\" : 0, \n \"details\" : [ \n \"at position 1: missing '_from' or '_to' attribute\" \n ] \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&type=documents&details=true\n{ \"_key\": \"abc\", \"value1\": 25, \"value2\": \"test\" }\n{ \"_key\": \"abc\", \"value1\": \"bar\", \"value2\": \"baz\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"created\" : 1, \n \"errors\" : 1, \n \"empty\" : 0, \n \"details\" : [ \n \"at position 2: creating document failed with error 'unique constraint violated', offending document: {\\\"_key\\\":\\\"abc\\\",\\\"value1\\\":\\\"bar\\\",\\\"value2\\\":\\\"baz\\\"}\" \n ] \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&type=documents&complete=true\n{ \"_key\": \"abc\", \"value1\": 25, \"value2\": \"test\" }\n{ \"_key\": \"abc\", \"value1\": \"bar\", \"value2\": \"baz\" }\n\nHTTP/1.1 409 Conflict\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"cannot create document, unique constraint violated\", \n \"code\" : 409, \n \"errorNum\" : 1210 \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&type=documents\n{ \"name\": \"test\" }\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"collection 'products' not found\", \n \"code\" : 404, \n \"errorNum\" : 1203 \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&type=list\n{ }\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"expecting a JSON list in the request\", \n \"code\" : 400, \n \"errorNum\" : 400 \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products\n[ \"_key\", \"value1\", \"value2\" ]\n[ \"abc\", 25, \"test\" ]\n\n[ \"foo\", \"bar\", \"baz\" ]\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"created\" : 2, \n \"errors\" : 0, \n \"empty\" : 1 \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&createCollection=true\n[ \"value1\", \"value2\" ]\n[ 1234, null ]\n[ \"foo\", \"bar\" ]\n[ 534.55, true ]\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"created\" : 3, \n \"errors\" : 0, \n \"empty\" : 0 \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=links\n[ \"_from\", \"_to\", \"name\" ]\n[ \"products/123\", \"products/234\", \"some name\" ]\n[ \"products/332\", \"products/abc\", \"other name\" ]\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"created\" : 2, \n \"errors\" : 0, \n \"empty\" : 0 \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=links&details=true\n[ \"name\" ]\n[ \"some name\" ]\n[ \"other name\" ]\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"created\" : 0, \n \"errors\" : 2, \n \"empty\" : 0, \n \"details\" : [ \n \"at position 1: missing '_from' or '_to' attribute\", \n \"at position 2: missing '_from' or '_to' attribute\" \n ] \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&details=true\n[ \"_key\", \"value1\", \"value2\" ]\n[ \"abc\", 25, \"test\" ]\n[ \"abc\", \"bar\", \"baz\" ]\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"created\" : 1, \n \"errors\" : 1, \n \"empty\" : 0, \n \"details\" : [ \n \"at position 2: creating document failed with error 'unique constraint violated', offending document: {\\\"_key\\\":\\\"abc\\\",\\\"value1\\\":\\\"bar\\\",\\\"value2\\\":\\\"baz\\\"}\" \n ] \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&complete=true\n[ \"_key\", \"value1\", \"value2\" ]\n[ \"abc\", 25, \"test\" ]\n[ \"abc\", \"bar\", \"baz\" ]\n\nHTTP/1.1 409 Conflict\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"cannot create document, unique constraint violated\", \n \"code\" : 409, \n \"errorNum\" : 1210 \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products\n[ \"_key\", \"value1\", \"value2\" ]\n[ \"abc\", 25, \"test\" ]\n[ \"foo\", \"bar\", \"baz\" ]\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"collection 'products' not found\", \n \"code\" : 404, \n \"errorNum\" : 1203 \n}\n
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products\n{ \"_key\": \"foo\", \"value1\": \"bar\" }\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"no JSON list found in second line\", \n \"code\" : 400, \n \"errorNum\" : 400 \n}\n