Open ke-zhang-rd opened 4 years ago
@shroffk
I am not sure (1) and (2) are bugs. I'm surprised that the server echos the tag content back at us in the response to PUT /tags
. What does that achieve? It seems a 200
status code would be a sufficient acknowledgement of success---no need to pay for echoing the data back.
Likewise, in our Python client, if the user gives us a tag or a logbook in a function call, there's no reason to return it if the return value is always identical to the input value. All we need to do it either raise (if the server gives us a bad status code) or return None
. Let's ignore the response.content
for PUT /tags
or---for extra paranoia---just verify that it equals the value that we submitted in our requests before returning.
(3) This looks like a server bug. No request should be able to trigger a 500
. This should probably be a 400 Bad Request
. Is there no documentation of what the expected parameters are?
(4) I think this should also return 400 Bad Request
. The server should be very clear about the difference between "No results" and "Invalid request" because on our side the first should return in []
and the second should raise an exception.
Hi
For 1 & 2, I decided to return the created resource so the client can verified that the created resource was in fact what they wanted to create...I can see the argument that 200 is clear enough.
I am fine with either returning only 200 or returning the created resource. What would you guys prefer?
@shroffk For (1) and (2) I'm happy either way. We can always ignore the response or use it to perform that extra validation. I hope my comments above weren't too strident ("What does that achieve?") --- I just meant to be thinking it through out loud.
@ke-zhang-rd Regardless, I think we should return None
at our level because we can do the validation internally, where applicable, and the caller can trust that if no exception was raised everything worked as expected.
For (3) that sounds good to me. @ke-zhang-rd Does it work if we submit requests in that format?
Is (4) actionable on your side, @shroffk?
Ok, I will return the created resources
above weren't too strident
no worries :)...I have been part of API designs that I did not even register this. I should be able to explain why something is done a particular way and you are free to ask for that.
@shroffk
For 3) cli.get_logs(start="2015-01-01 00:00:00.000")
this doesn't work. It return 500
@shroffk For 3)
cli.get_logs(start="2015-01-01 00:00:00.000")
this doesn't work. It return 500
This looks correct to me...
Can you check if the http request library is encoding this url path parameter correctly, can you send me a copy of the complete request.
In the server logs the service receives and empty string for 'end'.
I observed those issues and expect debug on server side summary
1.
put_property
method get a empty response now. However, client expect a dict like tags response2. Same issue of put_logbook.
3.
get_logs()
doesn't handlestart
andend
correctly4. unexpect keys in
get_logs
params , e.g. `get_logs(foo='bar') should return None or empty list not all logs.