Operation: Create Subscription

The Create Subscription operation is used to request a subscription to the Ontario Health publication service, for a particular subscription topic.

Specification

This specification is based on the FHIR R4B Create operations.

Subscription Create Request

The Create Subscription will create a new FHIR Subscription resource in the repository.

Usage:

POST [base]/Subscription/, where the HTTP Body contains a FHIR R4 Subscription resource, conformant to Profile: Subscription

Subscription Create Response

The server returns a 201 Created HTTP status code, and also returns a Location header which contains the new Logical Id and Version Id of the created resource version

Example Create Message

HTTP Method:

POST

Headers:

Content-Type: application/fhir+json

Address:

[base]/Subscription/

Message body:

{
  "resourceType" : "Subscription",
  "meta" : {
    "profile" : [
      "http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-subscription"
    ]
  },
  "status": "requested", 
  "criteria": "http://ontariohealth.ca/SubscriptionTopic/healthcareservice",
  "_criteria": {
    "extension": [ 
      {
        "url" : "http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-filter-criteria",
        "valueString" : "HealthcareService?program=http://ehealthontario.ca/fhir/CodeSystem/ca-on-phsd-programs|econsult"
      }
    ]
  },
  "channel" : {
    "extension" : [
      {
        "url" : "http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-heartbeat-period",
        "valueUnsignedInt" : 86400
      },
      {
        "url" : "http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-timeout",
        "valueUnsignedInt" : 60
      },
      {
        "url" : "http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-max-count",
        "valuePositiveInt" : 20
      }
    ],
    "type" : "rest-hook",
    "endpoint" : "https://example.org/Endpoints/d7dcc004-808d-452b-8030-3a3a13cd871d",
    "payload" : "application/fhir+json",
    "_payload" : {
      "extension" : [
        {
          "url" : "http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-payload-content",
          "valueCode" : "full-resource"
        }
      ]
    }
  }
}

Expected Behaviour

Case Scenario Description HTTP Status Code Response Payload
1 A valid Subscription is submitted, accepted, and created in the repository HTTP 201 Created. Returns the created resource.
2 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.
3 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.