flapjack / flapjack-diner

Consumer of the Flapjack API
http://flapjack.io/
MIT License
17 stars 10 forks source link

flapjack-diner should return a created resource's unique ID #36

Closed ghicks-rmn closed 9 years ago

ghicks-rmn commented 9 years ago

Right now, Diner returns 'true' if a request was sent successfully, and 'false' if it failed. Shouldn't it return any data that was sent to it from Flapjack instead?

For example, when I create a new Contact, I would expect to get its unique ID back in response so I can begin tying that contact to rules or entities. The JSON API does actually return this data, and Diner writes it to the API log - but there's no easy way to retrieve it in your code without performing a separate GET action, filtering it, and hoping that there are no duplicated names in your Flapjack setup.

Is there a reason that the simple 'true' and 'false' behavior was chosen over this? Should it be changed?

jessereynolds commented 9 years ago

@ghicks-rmn this makes sense to me - pass data back that's received from the api rather than returning true. @ali-graham your thoughts?

ghost commented 9 years ago

Diner's behaviour predates the JSONAPI, so there wasn't any consistent content to present at the time it was developed, and it hasn't been changed since. GETs currently return content as appropriate, and PATCHes and DELETEs don't have any content to return, so it would just be a matter of changing the code around POSTs to return the generated ids. I'll do this soon.

ghost commented 9 years ago

Actually, on further review, I'd already made this change in master since the last release. Bonus!

jessereynolds commented 9 years ago

:tada:

wolfspyre commented 9 years ago

This is awesome. What release is this planned to come out with, and when might that release hit ? We're trying to implement some tooling with flapjack-diner, and having this functionality would greatly simplify our tooling logic.