You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/rest-api.md
+50-16
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,25 @@ OPA integration using one of the [language SDKs](/ecosystem/#languages) than wor
36
36
with the REST API directly.
37
37
{{< /info >}}
38
38
39
+
## Common Request Headers
40
+
41
+
The following request headers are commonly used in some API endpoints:
42
+
43
+
#### Content-Type
44
+
45
+
It indicates the request body format. These are some values used in some APIs:
46
+
-`application/json` for JSON encoded content, e.g. a JSON document
47
+
-`application/yaml` for YAML encoded content, e.g. a YAML document
48
+
-`text/plain` for plain text content, e.g. a policy
49
+
50
+
#### Accept-Encoding
51
+
52
+
It could have `gzip` value which indicates the server should respond with a gzip encoded body. The server will send the compressed response only if its length is above `server.encoding.gzip.min_length` value. See the [configuration section](../configuration/#server).
53
+
54
+
#### Content-Encoding
55
+
56
+
It could have `gzip` value which indicates the request body is a gzip encoded object.
57
+
39
58
## Policy API
40
59
41
60
The Policy API exposes CRUD endpoints for managing policy modules. Policy modules can be added, removed, and modified at any time.
@@ -649,6 +668,10 @@ Create or update a policy module.
649
668
650
669
If the policy module does not exist, it is created. If the policy module already exists, it is replaced.
651
670
671
+
#### Request Headers
672
+
673
+
-**[Content-Type](#content-type)**: `text/plain`
674
+
652
675
#### Query Parameters
653
676
654
677
-**pretty** - If parameter is `true`, response will be formatted for humans.
@@ -751,6 +774,10 @@ Get a document.
751
774
752
775
The path separator is used to access values inside object and array documents. The server attempts to convert path segments to integers. If a path element cannot be converted to an integer, the server will use its string representation.
753
776
777
+
#### Request Headers
778
+
779
+
-**[Accept-Encoding](#accept-encoding)**: `gzip`
780
+
754
781
#### Query Parameters
755
782
756
783
-**input** - Provide an input document. Format is a JSON value that will be used as the value for the input document.
@@ -761,10 +788,6 @@ The path separator is used to access values inside object and array documents. T
761
788
-**instrument** - Instrument query evaluation and return a superset of performance metrics in addition to result. See [Performance Metrics](#performance-metrics) for more detail.
762
789
-**strict-builtin-errors** - Treat built-in function call errors as fatal and return an error immediately.
763
790
764
-
#### Request Headers
765
-
766
-
-**Accept-Encoding: gzip**: Indicates the server should respond with a gzip encoded body. The server will send the compressed response only if its length is above `server.encoding.gzip.min_length` value. See the configuration section
767
-
768
791
#### Status Codes
769
792
770
793
-**200** - no error
@@ -852,9 +875,9 @@ The request body contains an object that specifies a value for [The input Docume
852
875
853
876
#### Request Headers
854
877
855
-
-**Content-Type: application/yaml**: Indicates the request body is a YAML encoded object.
856
-
-**Content-Encoding: gzip**: Indicates the request body is a gzip encoded object.
857
-
-**Accept-Encoding: gzip**: Indicates the server should respond with a gzip encoded body. The server will send the compressed response only if its length is above `server.encoding.gzip.min_length` value. See the configuration section
878
+
-**[Content-Type](#content-type)**: `application/json` or `application/yaml`
-**Content-Type: application/yaml**: Indicates the request body is a YAML encoded object.
977
-
-**Content-Encoding: gzip**: Indicates the request body is a gzip encoded object.
978
-
-**Accept-Encoding: gzip**: Indicates the server should respond with a gzip encoded body. The server will send the compressed response only if its length is above `server.encoding.gzip.min_length` value. See the configuration section
999
+
-**[Content-Type](#content-type)**: `application/json` or `application/yaml`
@@ -1037,7 +1060,10 @@ Create or overwrite a document.
1037
1060
1038
1061
If the path does not refer to an existing document, the server will attempt to create all the necessary containing documents. This behavior is similar in principle to the Unix command `mkdir -p`.
1039
1062
1040
-
The server will respect the `If-None-Match` header if it is set to `*`. In this case, the server will not overwrite an existing document located at the path.
-**If-None-Match**: `*` - the server will not overwrite an existing document located at the path.
1041
1067
1042
1068
#### Query Parameters
1043
1069
@@ -1090,6 +1116,11 @@ The server accepts updates encoded as JSON Patch operations. The message body of
1090
1116
1091
1117
The effective path of the JSON Patch operation is obtained by joining the path portion of the URL with the path value from the operation(s) contained in the message body. In all cases, the parent of the effective path MUST refer to an existing document, otherwise the server returns 404. In the case of **remove** and **replace** operations, the effective path MUST refer to an existing document, otherwise the server returns 404.
@@ -1336,10 +1369,11 @@ Compile API requests contain the following fields:
1336
1369
|`options`|`object[string, any]`| No | Additional options to use during partial evaluation: `disableInlining` (default: undefined) and `nondeterminsticBuiltins` (default: false). |
1337
1370
|`unknowns`|`array[string]`| No | The terms to treat as unknown during partial evaluation (default: `["input"]`]). |
1338
1371
1339
-
### Request Headers
1372
+
####Request Headers
1340
1373
1341
-
-**Content-Encoding: gzip**: Indicates the request body is a gzip encoded object.
1342
-
-**Accept-Encoding: gzip**: Indicates the server should respond with a gzip encoded body. The server will send the compressed response only if its length is above `server.encoding.gzip.min_length` value
0 commit comments