Debian Codegraph @

doc/source/reference/executables/groonga-server-http.rst

raw
1 .. -*- rst -*-
2
3 Groonga HTTP server
4 ===================
5
6 Summary
7 -------
8
9 You can communicate by HTTP if you specify ``http`` to ``--protocol`` option. And output a file that is put under the path, and correspond to specified URI to HTTP request if you specify static page path by ``--document-root``.
10
11 Groonga has an Web-based administration tool implemented with HTML and JavaScript. If you don't specify ``--document-root``, regarded as administration tool installed path is specified, so you can use administration tool to access ``http://HOSTNAME:PORT/`` in Web browser.
12
13 Syntax
14 ------
15
16 You must specify ``--protocol http``::
17
18 groonga --protocol http -d [options...] DB_PATH
19
20 Usage
21 -----
22
23 You can use HTTP GET or HTTP POST to send a request. One request runs
24 only one command. You can't run multiple commands by one request.
25
26 You must use ``/d/${COMMAND_NAME}`` path for request.
27
28 Here is an example URL to run :doc:`/reference/commands/status`::
29
30 http://127.0.0.1:10041/d/status
31
32 If you use HTTP GET, you must specify parameters as URL "query".
33
34 Here is an example URL to specify ``3`` as ``command_version``::
35
36 http://127.0.0.1:10041/d/status?command_version=3
37
38 You can also specify multiple parameters::
39
40 http://127.0.0.1:10041/d/status?command_version=3&output_pretty=yes
41
42 If you use HTTP POST, you can specify parameters by URL "query" and
43 HTTP request body. If you use HTTP request body, you must specify
44 ``application/x-www-form-urlencoded`` as ``Content-Type`` header
45 value.
46
47 Here is an example HTTP POST request to specify multiple parameters by
48 HTTP request body::
49
50 POST /d/status HTTP/1.1
51 Host: 127.0.0.1:10041
52 Content-Length: 35
53 Content-Type: application/x-www-form-urlencoded
54
55 command_version=3&output_pretty=yes
56
57 You can mix URL "query" and HTTP request body::
58
59 POST /d/status?command_version=3 HTTP/1.1
60 Host: 127.0.0.1:10041
61 Content-Length: 17
62 Content-Type: application/x-www-form-urlencoded
63
64 output_pretty=yes
65
66 You can also use HTTP POST to specify data for
67 :doc:`/reference/commands/load`. If you send data by HTTP POST, you
68 can't specify parameters as HTTP body. You must specify parameters by
69 URL "path".
70
71 You must specify suitable HTTP ``Content-Type`` header value and
72 :doc:`/reference/commands/load` ``input_type`` parameter value for
73 your data. Here are available values:
74
75 .. list-table::
76 :header-rows: 1
77
78 * - ``Content-Type``
79 - ``input_type``
80 - Description
81 * - ``application/json``
82 - ``json``
83 - Send JSON data.
84 * - ``application/x-apache-arrow-streaming``
85 - ``apache-arrow``
86 - Send Apache Arrow data.
87
88 You can specify :doc:`/reference/command/output_format` as URL
89 "path" extension.
90
91 Here is an example HTTP request to get response as JSON::
92
93 http://127.0.0.1:10041/d/status.json
94
95 Here is an example HTTP request to get response as XML::
96
97 http://127.0.0.1:10041/d/status.xml
98
99 See also
100 --------
101
102 * :doc:`groonga-httpd`
103
104 * :doc:`/reference/commands/load`