# `Arangox.API.Import`
[🔗](https://github.com/ArangoDB-Community/arangox/blob/v0.8.0/lib/arangox/api/import.ex#L1)

ArangoDB's Import operations.

Every function takes the pool as its first argument and returns the decoded
response body. See `Arangox.API.Client` for the options they all accept and
for what a `404` returns.

# `data`

```elixir
@spec data(Arangox.conn(), binary(), binary(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Imports documents into a collection.

The body is sent as given under `text/plain`, so it must already be a binary
in one of the formats ArangoDB accepts. Say which one with `:type`:

  * `type: "documents"` - one JSON object per line (JSON Lines)
  * `type: "list"` - a single JSON array of objects
  * `type: "auto"` - let the server detect either of the above
  * no `:type` - the first line is a JSON array of attribute names, and every
    line after it is a JSON array of values in that same order

Importing into an edge collection requires `_from` and `_to` on every
document.

## Returns

Recorded against ArangoDB 3.12.10:

    %{
      "created" => integer,
      "empty" => integer,
      "error" => boolean,
      "errors" => integer,
      "ignored" => integer,
      "updated" => integer
    }

# `data!`

```elixir
@spec data!(Arangox.conn(), binary(), binary(), keyword()) :: term()
```

Import JSON data as documents. Raises on error.

See `data/3`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
