Get a document
This API endpoint returns the document specified by path.
The server will return a bad request (400) response if either:
- The query requires an input document and you do not provide it
- You provide the input document but the query has already defined it.
Request
- The document declares no server URL.
- Authnone required
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Query parameters
Provide the text for an input document in JSON format
{
"input": {
"example": {
"flag": true
}
}
}If true, response will be in a human-readable format.
If true, response will include build and version information in addition to the result.
If set to full, response will include query explanations in addition to the result.
If true, compiler performance metrics will be returned in the response.
If true, response will return additional performance metrics in addition to the result and the standard metrics.
Caution: This can add significant overhead to query evaluation. The recommendation is to only use this parameter if you are debugging a performance problem.
Response
Success
Example response
{
"result": [
{
"id": "example2",
"raw": "package opa.examples\\n\\nimport data.servers\\n\\nviolations[server] {\\n\\tserver = servers[_]\\n\\tserver.protocols[_] = \\\"http\\\"\\n\\tpublic_servers[server]\\n}\\n",
"ast": {
"package": {
"path": [
{
"type": "import",
"value": "data.opa.example"
}
]
},
"rules": [
{
"head": {
"name": "violations",
"key": {
"type": "var",
"value": "$0"
}
},
"body": [
{
"index": 1,
"terms": [
{
"type": "var"
}
]
}
]
}
]
}
}
],
"provenance": {
"build_commit": "4c6e524",
"build_hostname": "3bb58334a5a9"
},
"metrics": {
"timer_rego_input_parse_ns": 69994,
"timer_rego_query_parse_ns": 4096,
"timer_rego_query_compile_ns": 4096,
"timer_rego_query_eval_ns": 69994,
"timer_rego_module_parse_ns": 12345,
"timer_rego_module_compile_ns": 69994,
"timer_server_handler_ns": 631000,
"timer_server_read_bytes_ns": 631000,
"timer_query_compile_stage_build_comprehension_index_ns": 43000,
"timer_query_compile_stage_check_safety_ns": 852000,
"timer_query_compile_stage_check_types_ns": 577000,
"timer_query_compile_stage_check_undefined_funcs_ns": 426000,
"timer_query_compile_stage_check_unsafe_builtins_ns": 14000,
"timer_query_compile_stage_resolve_refs_ns": 3000,
"timer_query_compile_stage_rewrite_comprehension_terms_ns": 329000,
"timer_query_compile_stage_rewrite_dynamic_terms_ns": 27000,
"timer_query_compile_stage_rewrite_expr_terms_ns": 40000,
"timer_query_compile_stage_rewrite_local_vars_ns": 187000,
"timer_query_compile_stage_rewrite_to_capture_value_ns": 1178000,
"timer_query_compile_stage_rewrite_with_values_ns": 23000
},
"explanation": [
{
"op": "enter",
"type": "expr",
"node": {
"terms": [
{
"type": "var",
"value": "$term1"
}
]
}
}
]
}Changes
No recorded changes to this operation across all 6 revisions of this API.