While sending out webhook notifications from the server (as opposed to pull REST api) how do we model parent child relationships ? Should the change in child entity be represented as both a child update as well as a parent update ?
example: In the case of an article and comments associated with the article, the JSON representation could be :
{
"articleId" : 1231,
"articleContent" : "content string",
"articleComments" :[
{
"commentId" : 1,
"commentContent" : "this is the first comment",
},
{
"commentId" : 2,
"commentContent" : "this is the second comment",
}
]
}
If a comment add event were to occur, it can be interpreted in two ways :
1) A pure comment add event, where the payload may or may not contain the details of the article
2) An article update event, where we have successfully represented the relationship between comment and article but have obscured what actually happened.
We currently used the first way and used hypermedia formats to represent the relationships. Is there a better way to do this ?
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/api-craft.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.