Policy is a JSON schema filtering REST requests. The policy type PostgreSQL function is available on the form but at the moment only one policy type is working - JSON Schema. The Policy field is used to enter a JSON schema. By default the Policy field is preset to the Basic template, you can select another template from available Basic, Advanced and Pro templates.
Let's consider the work of the Basic template. Here is the JSON schema of the template:
{
"type": "object",
"properties": {
"method": {
"constant": "GET"
},
"uri": {
"type": "string",
"pattern": "/fhir.*"
}
}
}
In this schema two constraints are introduced:
Below the template selection element there is a tool for debugging. This tool consists of the following elements:
The Request Body area is used for displaying the request, the schema and the result with errors and warnings if any. For debugging the magic key __debug=true is used, so only request validation is performed, and the requests themselves are not executed. Let's perform the following tests to check our Basic template:
Positive:
Part result shows that there are no errors.
Negative:
Part result shows that there are two errors: POST method is used and only GET method is allowed; URI should start with /fhir, but it starts with /users.
To search by policy rule, simply enter the search text in the filter field. Records in the list will be immediately filtered according to your entry.