Proposal: send a "subId" parameter along with "subAction" in webhooks

19 views
Skip to first unread message

David Celis

unread,
May 17, 2013, 11:00:28 AM5/17/13
to brewer...@googlegroups.com
Hey guys,

I've been setting my site up with a few webhook endpoints and the way webhook requests are currently sent is leading to having to write a _lot_ of code (including unnecessary requests back to the BreweryDB API) for reasons that seem, to me, easily solvable. One of those reasons? A lack of context surrounding a given "subAction". An easy example:

1. Receive a webhook request:

  {
    "attribute":   "beer",
    "attributeId": "hELlo",
    "action":      "edit",
    "subAction":   "socialaccount-delete"
  }

2. Hit BreweryDB's API at /beer/hELlo/socialaccounts
3. Iterate over beer hELlo's social accounts locally, destroying any whose ID did not appear in the data set from above.
4. Repeat this sort of logic for every sub action (except alternate names, which I just store as an array directly on a Brewery).

It seems to me that, given an ID corresponding to the sub-action, this would be much easier and require fewer API requests to you. The same example:

1. Receive a webhook request:

  {
    "attribute":   "beer",
    "attributeId": "hELlo",
    "action":      "edit",
    "subAction":   "socialaccount-delete",
    "subId":       "aE4rF"
  }

2. Find social account aE4rF locally, destroy it.


I love BreweryDB so far, but the webhooks really leave something to be desired. I understand the desire for allowing users to handle data updates their own way, but you can still do that by providing more context behind updates.

Thanks for reading!

Jason Austin

unread,
May 17, 2013, 11:09:21 AM5/17/13
to brewer...@googlegroups.com
We can probably add that in.

- Jason


--
You received this message because you are subscribed to the Google Groups "Brewery DB API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brewerydb-ap...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Jason Austin
Co-Founder - PintLabs L.L.C.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages