mirror of https://gitee.com/bigwinds/arangodb
163 lines
11 KiB
JSON
163 lines
11 KiB
JSON
{
|
|
"basePath": "/",
|
|
"swaggerVersion": "1.1",
|
|
"apiVersion": "0.1",
|
|
"apis": [
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the list of database was compiled successfully. <br><br>",
|
|
"code": "200"
|
|
},
|
|
{
|
|
"reason": "is returned if the request is invalid. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the request was not executed in the <em>_system</em> database. <br><br>",
|
|
"code": "403"
|
|
}
|
|
],
|
|
"parameters": [],
|
|
"notes": "Retrieves the list of all existing databases <br><br> <em>Note</em>: retrieving the list of databases is only possible from within the <em>_system</em> database. <br><br>",
|
|
"summary": " List of databases",
|
|
"httpMethod": "GET",
|
|
"examples": "<br><br><br><br><pre><code class=\"json\">shell> curl --dump - http://localhost:8529/_api/database\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n \"_system\" \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "ListOfDatabases"
|
|
}
|
|
],
|
|
"path": "/_api/database"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the list of database was compiled successfully. <br><br>",
|
|
"code": "200"
|
|
},
|
|
{
|
|
"reason": "is returned if the request is invalid. <br><br>",
|
|
"code": "400"
|
|
}
|
|
],
|
|
"parameters": [],
|
|
"notes": "Retrieves the list of all databases the current user can access without specifying a different username or password. <br><br>",
|
|
"summary": " List of accessible databases ",
|
|
"httpMethod": "GET",
|
|
"examples": "<br><br><br><br><pre><code class=\"json\">shell> curl --dump - http://localhost:8529/_api/database/user\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n \"_system\" \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "ListOfAccessibleDatabases"
|
|
}
|
|
],
|
|
"path": "/_api/database/user"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the information was retrieved successfully. <br><br>",
|
|
"code": "200"
|
|
},
|
|
{
|
|
"reason": "is returned if the request is invalid. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the database could not be found. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [],
|
|
"notes": "Retrieves information about the current database <br><br> The response is a JSON object with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>name</em>: the name of the current database <li><em>id</em>: the id of the current database <li><em>path</em>: the filesystem path of the current database <li><em>isSystem</em>: whether or not the current database is the <em>_system</em> database",
|
|
"summary": " Information of the database",
|
|
"httpMethod": "GET",
|
|
"examples": "<br><br><br><br><pre><code class=\"json\">shell> curl --dump - http://localhost:8529/_api/database/current\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"name\" : \"_system\", \n \"id\" : \"74805\", \n \"path\" : \"/tmp/vocdir.19182/databases/database-74805\", \n \"isSystem\" : true \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "InformationOfTheDatabase"
|
|
}
|
|
],
|
|
"path": "/_api/database/current"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the database was created successfully. <br><br>",
|
|
"code": "201"
|
|
},
|
|
{
|
|
"reason": "is returned if the request parameters are invalid or if a database with the specified name already exists. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the request was not executed in the <em>_system</em> database. <br><br>",
|
|
"code": "403"
|
|
},
|
|
{
|
|
"reason": "is returned if a database with the specified name already exists. <br><br>",
|
|
"code": "409"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "Json",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "body",
|
|
"description": "the body with the name of the database. <br><br>"
|
|
}
|
|
],
|
|
"notes": "Creates a new database <br><br> The request body must be a JSON object with the attribute <em>name</em>. <em>name</em> must contain a valid database name. <br><br> The request body can optionally contain an attribute <em>users</em>, which then must be a list of user objects to initially create for the new database. Each user object can contain the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>username</em>: the user name as a string. This attribute is mandatory. <li><em>passwd</em>: the user password as a string. If not specified, then it defaults to the empty string. <li><em>active</em>: a boolean flag indicating whether the user account should be activated or not. The default value is <em>true</em>. <li><em>extra</em>: an optional JSON object with extra user information. The data contained in <em>extra</em> will be stored for the user but not be interpreted further by ArangoDB. </ul> If <em>users</em> is not specified or does not contain any users, a default user <em>root</em> will be created with an empty string password. This ensures that the new database will be accessible after it is created. <br><br> The response is a JSON object with the attribute <em>result</em> set to <em>true</em>. <br><br> <em>Note</em>: creating a new database is only possible from within the <em>_system</em> database. <br><br>",
|
|
"summary": " Create database",
|
|
"httpMethod": "POST",
|
|
"examples": "<br><br> Creating a database named <em>example</em>. <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/database <<EOF\n{\"name\":\"example\"}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n</code></pre><br><br><br> Creating a database named <em>mydb</em> with two users. <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/database <<EOF\n{\"name\":\"mydb\",\"users\":[{\"username\":\"admin\",\"passwd\":\"secret\",\"active\":true},{\"username\":\"tester\",\"passwd\":\"test001\",\"active\":false}]}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "CreateDatabase"
|
|
}
|
|
],
|
|
"path": "/_api/database"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the database was dropped successfully. <br><br>",
|
|
"code": "200"
|
|
},
|
|
{
|
|
"reason": "is returned if the request is malformed. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the request was not executed in the <em>_system</em> database. <br><br>",
|
|
"code": "403"
|
|
},
|
|
{
|
|
"reason": "is returned if the database could not be found. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "String",
|
|
"paramType": "path",
|
|
"required": true,
|
|
"name": "database-name",
|
|
"description": "The name of the database <br><br>"
|
|
}
|
|
],
|
|
"notes": "Drops the database along with all data stored in it. <br><br> <em>Note</em>: dropping a database is only possible from within the <em>_system</em> database. The <em>_system</em> database itself cannot be dropped. <br><br>",
|
|
"summary": " Drop database",
|
|
"httpMethod": "DELETE",
|
|
"examples": "<br><br><br><br><pre><code class=\"json\">shell> curl -X DELETE --dump - http://localhost:8529/_api/database/example\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "DropDatabase"
|
|
}
|
|
],
|
|
"path": "/_api/database/{database-name}"
|
|
}
|
|
]
|
|
}
|