Stream: implementers
Topic: Resource ids when POSTing to an Operation
Lloyd McKenzie (Aug 03 2018 at 22:06):
When we're POSTing to do a RESTful create
, the expectation is that Resource.id will be omitted, as it'll be assigned by the server. (We have exceptions to allow linking within a Bundle transaction.) What are the expectations for a resource conveyed in an operation invocation? Often the operation response will be a resource that will want to link to the request. Thus it would be helpful if the request included an id. In other cases, the id will be irrelevant. Should there be a standard expectation for whether the id needs to be present or not?
Grahame Grieve (Aug 03 2018 at 22:12):
I don't really understand this question. if you want to refer to it, it'll need an id so you can. But there's no rule that resources have to be identified to use them as operation parameters (and very often they aren't)
Lloyd McKenzie (Aug 03 2018 at 22:22):
The challenge is that if there's no expectation and I get a resource without an id but I want to link to it in the response, do I reject the request because there's no id or do I generate one? Should this be standard behavior or do I handle it in the profile for the operation inputs?
Grahame Grieve (Aug 03 2018 at 22:34):
you can't really generate an id, but you can echo the resource - 'this unidentified resource is the one I chose'. or you can return an error and say 'bozo, i can't tell you which unidentified resource I identify as my choice'
Grahame Grieve (Aug 03 2018 at 22:35):
but it should not be standard behavior - there is too much that is operation specific in this question
Lloyd McKenzie (Aug 03 2018 at 22:36):
I'm think of something like Claim$process. Send in a Claim, get back a ClaimResponse - which includes a Reference to Claim. They could just fill in ClaimResponse.claim.identifier, but that seems clunky to me.
Grahame Grieve (Aug 03 2018 at 22:36):
so reject it if it doesn't have an id, and document that it must have an id. And even create a profile...
Last updated: Apr 12 2022 at 19:14 UTC