Stream: implementers
Topic: Subscription Resource
Justin (Jul 26 2018 at 13:27):
Hey guys, working on a rest-hook subscription on a few test servers but getting no luck with it succeeding to reach my endpoint (my endpoint takes the resource and passes it to a staging area in my DB). I have been putting 2 subscription resources into these test servers, the rest-hook, and email channels so I know if i get an email but no data in my staging area that something is wrong with the endpoint but no luck on either. Can anyone help?
Vadim Peretokin (Jul 26 2018 at 13:41):
Try retrieving the subscription resource you've put up and see if what is it's status - should be active
, hopefully not error
Justin (Jul 26 2018 at 13:53):
for the 2 in my own hspconsortium.org test instance they are listed as active
and for the 2 I have in the https://api-stu3.hspconsortium.org/STU301withSynthea/open they are listed as requested
This is my Resource for the email channel:
{ "resourceType": "Subscription", "status": "requested", "contact": [ { "system": "phone", "value": "7#######00" } ], "end": "2021-01-01T00:00:00Z", "reason": "Monitor New and Updated Encounters", "criteria": "Encounter?status=arrived&_format=json", "channel": { "type": "email", "endpoint": "mailto:justin.loverme@email.com", "header": "New Encounter Arrived." }, "tag": [ { "system": "https://test.azurewebsites.net", "code": "Test" } ] }
Justin (Jul 26 2018 at 14:09):
and for the rest-hook:
{ "resourceType": "Subscription", "status": "requested", "contact": [ { "system": "phone", "value": "7#######00" } ], "end": "2021-01-01T00:00:00Z", "reason": "Monitor New and Updated Encounters", "criteria": "Encounter?status=arrived&_format=json", "channel": { "type": "rest-hook", "endpoint": "https://test.azurewebsites.net/Fhir/FhirController", "payload": "application/fhir+json" }, "tag": [ { "system": "https://test.azurewebsites.net", "code": "Test" } ] }
Vadim Peretokin (Jul 27 2018 at 06:20):
@Justin posting it to https://vonk.fire.ly/administration/Subscription
reveals:
"issue": [ { "severity": "error", "code": "invalid", "details": { "coding": [ { "system": "http://hl7.org/fhir/dotnet-api-operation-outcome", "code": "5002" } ], "text": "Criteria is not a valid in this subscription" } } ]
Better use "Encounter?status=arrived"
as remember _format=json
isn't part of search. Fixing that up, your subscription works!
Justin (Jul 27 2018 at 12:41):
Thanks @Vadim Peretokin ! And how do I get a Subscription to go from requested status to active?
Vadim Peretokin (Jul 27 2018 at 12:42):
@Justin the server automatically does it - try posting your example above to Vonk and GET
it straight after
Justin (Jul 27 2018 at 12:42):
Yes I see that now! Thank you!
Last updated: Apr 12 2022 at 19:14 UTC