Import Export

Import collection data

Create documents in the collection identified by collection parameter.

post/_fabric/{fabric}/_api/import/{collection}

Request

Path parameters

fabricstring string required

The name of the fabric.

collectionstring string required

The name of the collection.

Request body

dataobject[]

An array of JSON documents. Each document is interpreted separately. If the primaryKey property (see below) is not set or equals auto, then the _key attribute values of the documents must be strings. The maximum number of documents that can be imported is limited by the Max Documents Imported Per API Call limit.

detailsboolean

If true extra information for errors and unprocessed documents are returned in the result.

primaryKeystring string

If used, this attribute becomes the _key for the new document. If the values in the attribute are not strings, they are convert to strings before import. Any existing _key value is renamed to old_key. Use the following naming convention: https://macrometa.dev/documents/naming-conventions/#document-keys

replaceboolean

If true, existing document having same _key in the colletion, shall be replaced.

Example request

{
  "data": [
    {
      "_key": "1634556",
      "name": "test1"
    }
  ]
}

Response

Successfully imported data.

If there are any errors, an additional header X-C8-Error-Codes is set, that contains a map of the error codes that occurred together with their multiplicities, as in: 1205:10,1210:17 which means that in 10 cases the error 1205 "illegal document handle" and in 17 cases the error 1210 "unique constraint violated" has happened. The response body has additional failed document details in details object.

codeinteger

HTTP response code.

errorboolean

Flag if there is an error in response. False for this response.

Example response

{
  "code": 200,
  "result": {
    "created": 3
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.