Aidbox/Issues

I need help on deleted Subscription ID.

Closed this issue · 9 comments

What is the current behaviour when we hit a PUT request to a deleted subscription ID. Is the response compliance to the REST principles ?

Hi, please specify the urgency of the request. Also it would be perfect if you provide some additional details on current/desires state or just describe the issue you are having

I'll certainly help with the details and it's bit urgent too.
However, could you help me with the question "What is the current behaviour when we hit a PUT request to a deleted subscription ID. Is the response compliance to the REST principles ?"

The current behaviour what we have observed from the "PUT request on a deleted subscription ID" is it recreates the deleted subscriptionID . However, based on the rest principles if we hit a PUT request on the non-existent resource then it should create a new subcrisciptionID .
Hence posted this question and was seeking an answer on this.

understood, could you please provide initial deleted resource body, delete method and PUT request and body you are making?

Please find the entire payload, along with the deleted subcriptionID :

{
"meta": {
"lastUpdated": "2022-07-07T04:13:06.847882Z",
"createdAt": "2022-07-07T04:13:06.847882Z",
"versionId": "153206"
},
"criteria": "Patient",
"channel": {
"type": "rest-hook",
"header": [

    ],
    "payload": "application/fhir+json",
    "endpoint": "https://temprequestcatcher.requestcatcher.com/test"
},
"resourceType": "Subscription",
"reason": "Subscription created to fetch resource",
"status": "active",
"id": "83d75019-235e-4846-89aa-7d19bf17c805",                             // This is the deleted subscription ID
"error": "",
"end": "2021-01-01T00:00:00Z"

}

Thanks, how did you delete the subscription: was it just DELETE /Subscription/83d75019-235e-4846-89aa-7d19bf17c805? Also please provide the following PUT request (with body) you've made.

@VarvaraSemenova

step 1: Create a subscription with following body(POST)
REQUEST:
POST {{FHIRserver}}/fhir/Subscription
body :
{
"resourceType" : "Subscription",
"status" : "requested",
"end" : "2023-01-01T00:00:00Z",
"reason" : "Subscription created to fetch resource",
"criteria" : "Patient",
"error" : "",
"channel" : {
"type" : "rest-hook",
"endpoint" : "https://demo123.requestcatcher.com/test",
"payload" : "application/fhir+json",
"header" : []
}
}

	RESPONSE:
	{
	"meta": {
		"lastUpdated": "2022-07-28T08:33:32.098331Z",
		"createdAt": "2022-07-28T08:33:32.098331Z",
		"versionId": "207056"
	},
	"criteria": "Patient",
	"channel": {
		"type": "rest-hook",
		"header": [],
		"payload": "application/json",
		"endpoint": "https://demo123.requestcatcher.com/test"
	},
	"resourceType": "Subscription",
	"reason": "Subscription created to fetch resource1",
	"status": "requested",
	"id": "168e5054-a8d6-47ef-9386-83fddccab27c",
	"error": "",
	"end": "2021-01-01T00:00:00Z"
	}

step 2: check whether the subscription is created with GET request for "168e5054-a8d6-47ef-9386-83fddccab27c" subscription Id

	REQUEST:
	GET {{FHIRserver}}fhir/Subscription/168e5054-a8d6-47ef-9386-83fddccab27c
	
	RESPONSE:
	{
	"meta": {
		"lastUpdated": "2022-07-28T08:33:34.619135Z",
	"createdAt": "2022-07-28T08:33:32.098331Z",
		"versionId": "207060"
	},
	"criteria": "Patient",
	"channel": {
		"type": "rest-hook",
		"header": [],
		"payload": "application/json",
		"endpoint": "https://demo123.requestcatcher.com/test"
	},
	"resourceType": "Subscription",
	"reason": "Subscription created to fetch resource1",
	"status": "active",
	"id": "168e5054-a8d6-47ef-9386-83fddccab27c",
	"error": "",
	"end": "2021-01-01T00:00:00Z"
	}

step 3: delete the subscription with DELETE method for 168e5054-a8d6-47ef-9386-83fddccab27c subscription ID

	REQUEST:
	DELETE {{FHIRserver}}/fhir/Subscription/168e5054-a8d6-47ef-9386-83fddccab27c
	
	RESPONSE:
	{
	"meta": {
		"lastUpdated": "2022-07-28T08:38:32.109060Z",
		"createdAt": "2022-07-28T08:38:32.109060Z",
		"versionId": "207065"
	},
	"criteria": "Patient",
	"channel": {
		"type": "rest-hook",
		"header": [],
		"payload": "application/json",
		"endpoint": "https://demo123.requestcatcher.com/test"
	},
	"resourceType": "Subscription",
	"reason": "Subscription created to fetch resource1",
	"status": "active",
	"id": "168e5054-a8d6-47ef-9386-83fddccab27c",
	"error": "",
	"end": "2021-01-01T00:00:00Z"
	}

step 4: check whether the subscription is deleted with GET request for "168e5054-a8d6-47ef-9386-83fddccab27c" subscription Id

	REQUEST:
	GET {{FHIRserver}}/fhir/Subscription/168e5054-a8d6-47ef-9386-83fddccab27c
	
	RESPONSE:
	{
	"resourceType": "OperationOutcome",
	"id": "deleted",
	"text": {
		"status": "generated",
		"div": "Resource Subscription/168e5054-a8d6-47ef-9386-83fddccab27c not found"
	},
	"issue": [
		{
			"severity": "fatal",
			"code": "deleted",
			"diagnostics": "Resource Subscription/168e5054-a8d6-47ef-9386-83fddccab27c not found"
		}
	]
	}

step 5 : perform a update operation on subscription with deleted subscription ID.
REQUEST:
PUT {{FHIRserver}}/fhir/Subscription/168e5054-a8d6-47ef-9386-83fddccab27c

	body:
	{
	"meta": {
		"lastUpdated": "2022-07-28T08:33:32.098331Z",
		"createdAt": "2022-07-28T08:33:32.098331Z",
		"versionId": "207056"
	},
	"criteria": "Patient",
	"channel": {
		"type": "rest-hook",
		"header": [],
		"payload": "application/json",
		"endpoint": "https://demo123.requestcatcher.com/test"
	},
	"resourceType": "Subscription",
	"reason": "Subscription created to fetch resource1",
	"status": "requested",
	"id": "168e5054-a8d6-47ef-9386-83fddccab27c",
	"error": "",
	"end": "2021-01-01T00:00:00Z"
	}
	
	RESPONSE:
	{
	"meta": {
		"lastUpdated": "2022-07-28T08:44:30.503334Z",
		"createdAt": "2022-07-28T08:44:30.503334Z",
		"versionId": "207070"
	},
	"criteria": "Patient",
	"channel": {
		"type": "rest-hook",
		"header": [],
		"payload": "application/json",
		"endpoint": "https://demo123.requestcatcher.com/test"
	},
	"resourceType": "Subscription",
	"reason": "Subscription created to fetch resource1",
	"status": "requested",
	"id": "168e5054-a8d6-47ef-9386-83fddccab27c",
	"error": "",
	"end": "2021-01-01T00:00:00Z"
	}

step 6: check whether the subscription is created with GET request for "168e5054-a8d6-47ef-9386-83fddccab27c" subscription Id

	REQUEST:
	GET {{FHIRserver}}/fhir/Subscription/168e5054-a8d6-47ef-9386-83fddccab27c
	
	RESPONSE:
	{
	"meta": {
		"lastUpdated": "2022-07-28T08:44:30.503334Z",
		"createdAt": "2022-07-28T08:44:30.503334Z",
		"versionId": "207070"
	},
	"criteria": "Patient",
	"channel": {
		"type": "rest-hook",
		"header": [],
		"payload": "application/json",
		"endpoint": "https://demo123.requestcatcher.com/test"
	},
	"resourceType": "Subscription",
	"reason": "Subscription created to fetch resource1",
	"status": "requested",
	"id": "168e5054-a8d6-47ef-9386-83fddccab27c",
	"error": "",
	"end": "2021-01-01T00:00:00Z"
	}	

Hello @PavanPatro-Innovaccer!
According to HTTP RFC specification, you can use PUT
method for resource creation or modification.

You're creating new resource providing id and body for resource as a result you get a new resource based on provided body and id.

@PavanPatro-Innovaccer Hi, did it answer your question or do you need any further clarification?