Delete an access policy
- Sandbox: available
- On your own host? Choose https://{host} in the playground.
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_POLICYnames, is refused withPOLICY_IN_USE. The error says which:heldByMembersandsettings. - Ovok's own policies and copies of a parent project's policies are refused with
POLICY_READ_ONLY.
Example
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.
bearerAuthorizationBearer <JWT>id*stringDeleted, with its copies in child projects.
curl -X DELETE 'https://api.sandbox.ovok.com/v1/access-policies/string'Get an access policy GET
Reads one access policy of the project. **Scope:** the caller's project (from the token). ## Behaviour - `versionId` is what `If-Match` takes 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 ```bash 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](/access-policies#who-can-call-a-route).
Replace an access policy PUT
Replaces an access policy's name and rules, and keeps its other fields. Members who hold the policy gain or lose that access at once. Its copies in child projects follow. **Scope:** the caller's project (from the token). ## Behaviour - `If-Match: W/"<versionId>"` is required. A missing header answers `428`, and one that is not an entity tag answers `400`. `If-Match: *` writes over the version Ovok reads just before it. A policy that changed since the version you named answers `412`: read it again and retry. - Send every rule. A rule you leave out stops applying. - The rules are checked as on create. Ovok's own policies and copies of a parent project's policies are refused with `POLICY_READ_ONLY`. ## Example ```bash curl -X PUT 'https://api.sandbox.ovok.com/v1/access-policies/POLICY_ID' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'If-Match: W/"3"' \ -H 'Content-Type: application/json' \ -d '{"name":"Ward nurse","rules":[{"resourceType":"Patient","interaction":["read","search"],"criteria":"Patient?organization=%organization"}]}' ``` **Who can call it:** a project admin. See [roles](/access-policies#who-can-call-a-route).