Interaction: Modify Subscription

The Update Subscription operation is used to update a exist subscription on the Ontario Health Subscription service.

Specification

This specification is based on the FHIR R5 Backport specification.

Usage

Modify Subscription Request

`PUT /Subscription/{subscription-id}`

`Content-Type: application/fhir+json`

where [subscription-id] is the logical id of the existing Subscription resource, and the HTTP Body contains a FHIR R4 Subscription resource, conformant to Profile: Subscription

Modify Subscription Response

The server returns a 200 OK HTTP status code, and also returns a Location header which contains the new Logical Id and Version Id of the updated resource version

Interaction Sequence Diagram

Sub_Modify

Example of Modify Subscription Interaction

This request updates an existing Subscription resource to modify its criteria and endpoint.

Request Message:

PUT [base]/Subscription/123456 HTTP/1.1

Host: fhir-server.example.com

Content-Type: application/fhir+json

{
  "resourceType": "Subscription",
  "id": "123456",
  "status": "active",
  "reason": "Monitor new Patient resources",
  "criteria": "Patient?active=true",
  "channel": {
    "type": "rest-hook",
    "endpoint": "https://client.example.com/notifications",
    "header": [
      "Authorization: Bearer some-jwt-token"
    ],
    "payload": "application/fhir+json"
  },
  "extension": [
    {
      "url": "http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-channel-type",
      "valueCode": "rest-hook"
    },
    {
      "url": "http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-topic",
      "valueCanonical": "http://example.com/fhir/SubscriptionTopic/PatientUpdates"
    }
  ]
}

Response Message:

HTTP 200 OK

Content-Type: application/fhir+json

{
  "resourceType": "Subscription",
  "id": "123456",
  "meta": {
    "versionId": "2",
    "lastUpdated": "2025-02-07T12:00:00Z"
  },
  "status": "active",
  "reason": "Monitor new Patient resources",
  "criteria": "Patient?active=true",
  "channel": {
    "type": "rest-hook",
    "endpoint": "https://client.example.com/notifications",
    "header": [
      "Authorization: Bearer some-jwt-token"
    ],
    "payload": "application/fhir+json"
  },
  "extension": [
    {
      "url": "http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-channel-type",
      "valueCode": "rest-hook"
    },
    {
      "url": "http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-topic",
      "valueCanonical": "http://example.com/fhir/SubscriptionTopic/PatientUpdates"
    }
  ]
}


Expected Bahaviour

Case Scenario Description HTTP Status Code Response Payload
1 A valid Subscription is submitted, accepted, and updated in the repository HTTP 200 OK Returns the updated resource.
2 The submitted Subscription does not exist in the repository HTTP 201 Update resulted in the creation of a new resource.
3 The submitted Subscription cannot be validated as it does not conform to the specification HTTP 400 Bad Request. Returns an OperationOutcome resource indicating an issue. The client must fix the request and try again.
4 Subsciprtion API validates the request but cannot return a valid response due to internal issues. HTTP 500 Internal Server Error. Returns an OperationOutcome resource indicating an issue.