Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add REST examples for patching security tag #4698

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions docs/rest/FhirPatchRequests.http
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,65 @@ Authorization: Bearer {{bearer.response.body.access_token}}
]
}
]
}

### Add a security tag. This will always add the elements to the end of the array if the array exists or not.
PATCH https://{{hostname}}/Patient/{{patient.response.body.id}}
content-type: application/fhir+json
Authorization: Bearer {{bearer.response.body.access_token}}

{
"resourceType": "Parameters",
"parameter": [
{
"name": "operation",
"part": [
{
"name": "type",
"valueCode": "add"
},
{
"name": "path",
"valueString": "Patient.meta"
},
{
"name": "name",
"valueString": "security"
},
{
"name": "value",
"valueCoding": {
"system": "http://example.org/security-system",
"code": "SECURITY_TAG_CODE",
"display": "New Security Tag Display"
}
}
]
},
{
"name": "operation",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does having 2 values add to the example?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shows that one operation doesn't replace the array if it already exists. Would it make sense in two requests?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see. That makes sense.

"part": [
{
"name": "type",
"valueCode": "add"
},
{
"name": "path",
"valueString": "Patient.meta"
},
{
"name": "name",
"valueString": "security"
},
{
"name": "value",
"valueCoding": {
"system": "http://example.org/security-system",
"code": "NEW_SECURITY_TAG_CODE",
"display": "New Security Tag Display"
}
}
]
}
]
}
39 changes: 38 additions & 1 deletion docs/rest/JsonPatchRequests.http
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Authorization: Bearer {{bearer.response.body.access_token}}
}

### Conditional Patch
PATCH {{fhirurl}}/Patient?identifier=1032704
PATCH {{hostname}}/Patient?identifier=1032704
content-type: application/json-patch+json
Authorization: Bearer {{bearer.response.body.access_token}}

Expand All @@ -202,3 +202,40 @@ Authorization: Bearer {{bearer.response.body.access_token}}
}
}
]

### Add a security tag. Replaces entire array if it exists
PATCH https://{{hostname}}/Patient/{{patient.response.body.id}}
content-type: application/json-patch+json
Authorization: Bearer {{bearer.response.body.access_token}}

[
{
"op": "add",
"path": "/meta/security",
"value": [
{
"system": "http://example.org/security-system",
"code": "SECURITY_TAG_CODE",
"display": "Security Tag Display"
}
]
}
]

### Add a security tag. Array must already exist.
# You cannot use JSON patch to add when you don't know if the array exists. Use FHIR Patch in this scenario.
PATCH https://{{hostname}}/Patient/{{patient.response.body.id}}
content-type: application/json-patch+json
Authorization: Bearer {{bearer.response.body.access_token}}

[
{
"op": "add",
"path": "/meta/security/-",
"value": {
"system": "http://example.org/security-system",
"code": "NEW_SECURITY_TAG_CODE",
"display": "New Security Tag Display"
}
}
]
Loading