Check what a member may do with a resource
- Sandbox: available
- On your own host? Choose https://{host} in the playground.
Shows what a member's own access policy lets them do with one resource of the project. It answers by the rule Medplum would match, and lists what that rule hides.
Scope: the caller's project (from the token).
Behaviour
personis the member's profile, such asPractitioner/123.resourceis a resource of the project, such asPatient/456.interactionisreadby default.- The caller must be able to read
resourcethemselves. Otherwise the answer is404, so the check reveals nothing the caller's own policy hides. - The policy is the member's own, as Medplum builds it at sign-in: every policy on the membership, with each
accessentry's parameters filled in. - When access is allowed,
ruleis the first rule that matches, as Medplum picks it, andhiddenFieldsare the fields the member does not see. When it is not,reasonsays why:no_account: no active membership in the project.no_policy: the membership has no policy Ovok can apply. Medplum would give it every resource, so Ovok never does.no_matching_rule: no rule grants the interaction on this resource.
- For a write, Medplum also applies the rule's
writeConstraintandreadonlyFieldsto the resource being written. This check does not run them: read them inrule. - Ovok applies the same decision where it acts for a member, such as who is told of an omni-channel alert.
Example
curl -X POST 'https://api.sandbox.ovok.com/v1/access-policies/check' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{"person":"Practitioner/PRACTITIONER_ID","resource":"Patient/PATIENT_ID","interaction":"read"}'Who can call it: a project admin. See roles.
bearerAuthorizationBearer <JWT>application/json- body
person*stringThe member's profile, such as Practitioner/123.
^(Practitioner|Patient|RelatedPerson|ClientApplication|Bot)\/[A-Za-z0-9\-.]{1,64}$resource*stringA resource of the project, such as Patient/456.
^[A-Z][A-Za-z]{1,63}\/[A-Za-z0-9\-.]{1,64}$interaction?string"read""read""vread""update""delete""history""create""search"Whether their own policy allows it, by which rule, and what it hides.
application/json- response
person*stringresource*stringinteraction*string"read""vread""update""delete""history""create""search"allowed*booleanreason*stringno_account: no active membership in the project. no_policy: the membership has no policy Ovok can apply. no_matching_rule: no rule grants the interaction on this resource. Null when allowed.
"no_account""no_policy""no_matching_rule"rule*The rule that grants it, the first that matches, as Medplum picks it. A write is also held to its writeConstraint and readonlyFields, which this check does not run.
hiddenFields*array<string>Fields the person does not see on this resource.
curl -X POST 'https://api.sandbox.ovok.com/v1/access-policies/check' \ -H 'Content-Type: application/json' \ -d '{ "person": "string", "resource": "string"}'{ "person": "string", "resource": "string", "interaction": "read", "allowed": true, "reason": "no_account", "rule": { "resourceType": "string", "interaction": [ "read" ], "criteria": "string", "hiddenFields": [ "string" ], "readonlyFields": [ "string" ] }, "hiddenFields": [ "string" ]}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).
Translate text POST
Translates a list of strings from one language to another with an LLM. Use it to draft translations for content and localization keys. **Auth:** bearer token. **Scope:** the caller's project (from the token). The project's settings can add instructions to the translation prompt. ## Behaviour - `sourceLanguage` and `targetLanguage` take a language code such as `en` or `de-DE`, or a language name. Each is 2 to 100 characters. - `text` holds 1 or more strings. Each string and all strings together are limited to 10,000 characters. - Strings can be plain text, HTML or Markdown, and can contain placeholders such as `{{name}}`. Markup and placeholders are meant to be kept as they are, but the output comes from an LLM, so check it before you publish it. - The response returns the translations in `text`, in the same order as the input. - If the project has a setting named `TRANSLATION_ADDITIONAL_PROMPT`, its value is added to the prompt for every translation in that project. - Nothing is stored. The route only returns the translation. ## Example ```bash curl -X POST 'https://api.sandbox.ovok.com/ai/translation' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "sourceLanguage": "en", "targetLanguage": "de", "text": ["Hello {{name}}, how are you?", "<p>Your appointment is <b>today</b>.</p>"] }' ```