easyping
easyping

Reputation: 11

How to add ArangoDB database to endpoint?

In the documentation I only find information on how to retrieve the list of endpoints, but not how to add a database to the endpoint. How does it work?

Upvotes: 0

Views: 217

Answers (3)

dothebart
dothebart

Reputation: 6067

you can use the create database api to create new databases:

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/database <<EOF
{ 
  "name" : "example" 
}
EOF

HTTP/1.1 201 Created
content-type: application/json; charset=utf-8

{ 
  "result" : true, 
  "error" : false, 
  "code" : 201 
}

which then in term will appear on that list.

Upvotes: 0

easyping
easyping

Reputation: 11

The creation of databases was known to me. My concern is that a specific endpoint may be used by only certain databases.

With GET / _api / endpoint can I get the list of endpoints with their databases, but how do I add databases in this list?

Upvotes: 0

stj
stj

Reputation: 9097

The endpoint is the IP address/port the ArangoDB instance will listen on for incoming requests. The default endpoint for ArangoDB is 127.0.0.1:8529, but often this is changed to another IP address/port combination. Normally you will want to have just one or two endpoints, which you don't want to change while the server is running.

If you have the endpoint for the ArangoDB instance, you can make HTTP requests to it. There is one type of requests that can create a new database within the ArangoDB instance (see manual).

An example HTTP request (using curl) for creating a database is:

curl -X POST --data-binary "{\"name\":\"example\"}" --dump - http://127.0.0.1:8529/_api/database

From the ArangoShell you can also add a database using the db._createDatabase() function.

Upvotes: 2

Related Questions