-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an API to retrieve diff results in JSON format #46
Comments
On thing to note is that pulling down the nugets and creating the diff can take a few seconds the first time. The current site is polling until it gets the data. Should we consider:
Thoughts? cc @ParticularLabs/apicomparer |
I'd be happy for it just to block until the result is complete. |
Blocking is so oldschool ;)
|
...another option is the client registers a webhook, which you call upon completion. I prefer a simple blocking HTTP call, it's not like you're keeping the client waiting that long (and it's all done async using ajax anyway), everything else adds complexity, especially when you scale to multiple web servers. |
Agree with @richorama , lets go simple first? |
What defines simplicity? Is it from the implementation or usage perspective? As far as implementing having an HTTP endpoint for the command and a relocate to a query endpoint I wouldn't consider it complex implementation-wise. From a usage perspective it is, yes. Currently not an issue but when we designed the first approach we said because downloading nugets etc can take time we would like a non-blocking way. Now when we talk about the API level we favour "simplicity" by ignoring our initial non-functional requirement?
|
I'll clarify my position. From the perspective of the consumer (I think) it's easier to have a single http get to retrieve the results, which are returned on the response to that single request. From an implementation perspective I would suggest you use async & await, and don't block a thread, but that's an implementation detail (or optimisation). This has the advantage that http responses are essentially immutable, and can be heavily cached. If this isn't achievable/desirable, then I think the next best option is to use one http post to start the comparison process, the client can then make multiple gets to query the progress, and attempt to retrieve the result. |
I do see your point @danielmarbach How about we do this. Case 1 - Results already availableSince we cache the generated diffs we can just send them back right away with a Case 2 - No comparison availableIf the
This will force the client to keep on calling until a |
👍 Although returning One thing that may also be added on top of it would be headers preventing any kind of caching for |
Agreed, good points regarding the caching. Side note: we actually render the results as html and stores it so its On Fri, Sep 4, 2015 at 7:25 PM, nulltoken [email protected] wrote:
|
An API supporting diff results as JSON would be very useful.
I'm planning on using this to support version comparison on http://nugot.net
It would also be useful if CORS/JSONP was supported, allowing me to retrieve the diff directly from the browser.
The text was updated successfully, but these errors were encountered: