简体   繁体   中英

ArangoDB HTTP API Bulk Import Testing

What tool do I use to execute the code shown in the Examples in the ArangoDB Documentation for Inserting Documents using the HTTP API. I thought it was arangosh.exe but not so sure anymore.

For example: The Arango 3.3 HTTP Bulk Import Documentation examples look like this:

在此输入图像描述

In the examples I see

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products

I am assuming (Most likely assuming incorrectly) that the examples are using the Arango Shell which can be opened using arangosh.exe from the command prompt.

Below is a successful login into Arango using the Arango Shell. 在此输入图像描述

Next is my attempt to use the syntax shown in the examples contained within the API ArangoDB documentation. 在此输入图像描述

What am I doing wrong here?

To use the HTTP API, you need some tool to issue HTTP requests with different methods (GET, POST, PUT, DELETE), potentially with protocol-typical authentication and payload.

curl is such a tool. In case of Windows as operating system, it is not available by default. You can download builds for various OS here: https://curl.haxx.se/download.html

It is a command line tool. Run it in a shell, ie command prompt or Powershell on Windows. You can not run it inside of arangosh ! The ArangoDB shell is essentially a JavaScript REPL shell to interact with ArangoDB using a JavaScript interface. You can't run commands like in a OS shell here.

Please also note that there is a tool of its own for importing data from files into ArangoDB. The tool is named arangoimp (or arangoimport in current devel). It is installed alongside with ArangoDB on Windows and other platforms.

arangoimp.exe can be invoked from Powershell or a command prompt. More details can be found in the manual . But again, arangoimp is not supposed to be started from inside the ArangoShell (arangosh), but from Powershell or a command prompt!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM