Get an access policy
- Sandbox: available
- On your own host? Choose https://{host} in the playground.
Reads one access policy of the project.
Scope: the caller's project (from the token).
Behaviour
versionIdis whatIf-Matchtakes when you change the policy.- A policy of another project is refused with
POLICY_NOT_IN_PROJECT, even when Medplum lets the caller read it through a linked project.
Example
curl 'https://api.sandbox.ovok.com/v1/access-policies/POLICY_ID' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk'Who can call it: a project admin. See roles.
bearerAuthorizationBearer <JWT>id*stringThe policy, each rule with what it grants spelled out.
application/json- response
id*stringreference*stringname*stringversionId*stringSend it back as If-Match: W/"<versionId>" to change the policy.
managed*booleanOvok provisions the policy (a Signals role), so it is read-only.
copyOf*stringThe parent project's policy this one copies; read-only here.
rules*array<>Each row with what it grants spelled out in interaction.
curl -X GET 'https://api.sandbox.ovok.com/v1/access-policies/string'{ "id": "string", "reference": "string", "name": "string", "versionId": "string", "managed": true, "copyOf": "string", "rules": [ { "resourceType": "string", "interaction": [ "read" ], "criteria": "string", "hiddenFields": [ "string" ], "readonlyFields": [ "string" ] } ]}Create an access policy POST
Creates an access policy. Its copies in child projects follow. **Scope:** the caller's project (from the token). Medplum writes it on behalf of the caller. ## Behaviour - `name` must be unique in the project, with no commas or backslashes, because child projects find their copy by name. - Each rule must be one that Medplum applies as written. Otherwise the request is refused with `422`, and the message says which rule fails and why: - `criteria` searches the rule's own resource type; - the only modifiers are `:not`, `:missing` and `:present`; - there are no chained searches and no `_has`; - a Signals row such as `signals_alerts` has no `criteria`; - every `writeConstraint` is a FHIRPath expression. - `%parameters` such as `%patient` or `%organization` are left for each member's `access` entry to fill in. - The answer is `201`, and `Location` names the new policy. ## Example ```bash curl -X POST 'https://api.sandbox.ovok.com/v1/access-policies' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{"name":"Ward nurse","rules":[{"resourceType":"Patient","interaction":["read","search"],"criteria":"Patient?organization=%organization"},{"resourceType":"signals_alerts","interaction":["read"]}]}' ``` **Who can call it:** a project admin. See [roles](/access-policies#who-can-call-a-route).
Delete an access policy DELETE
Deletes an access policy, and its copies in child projects with it. This cannot be undone. **Scope:** the caller's project (from the token). ## Behaviour - A policy that a member holds, or that a project setting such as `DEFAULT_PATIENT_ACCESS_POLICY` names, is refused with `POLICY_IN_USE`. The error says which: `heldByMembers` and `settings`. - Ovok's own policies and copies of a parent project's policies are refused with `POLICY_READ_ONLY`. ## Example ```bash curl -X DELETE 'https://api.sandbox.ovok.com/v1/access-policies/POLICY_ID' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ``` **Who can call it:** a project admin. See [roles](/access-policies#who-can-call-a-route).