Open GoogleCodeExporter opened 8 years ago
the value of "data" when status_code != 200 should be treated as undefined (ie:
you should not depend on any specific value to catch errors). we will update
our documentation to reflect that.
Original comment by jehiah
on 29 Nov 2010 at 3:48
Yes, I've understood your explanation about what I should do to identify any
error (status_code != 200) in my app.
However I think I haven't explained exactly what the problem is.
Actually, the issue is: two different types in the return of Shorten JSON
endpoint.
When I receive a successful reponse(staus code = 200) the method returns an
'simple' Object, but when any error happens the method return an empty Object
Array - a completely different type of return.
And it happens only in Shorten endpoint.
For example, if you call
http://api.bit.ly/v3/info?login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d
71bf07&format=json the response will be an 500 error with data member as NULL.
On the other hand, calling
http://api.bit.ly/v3/shorten?login=digiogo&apiKey=e73334a3ee6bed79705612c&longUr
l=dasdhttp://www.fiap.com.br&format=json generates the same error 500, but data
member will be [ ].
If data member was an array in well-succeded responses, there wouldn't be any
problem.
Could you understand my view about the issue?
If you agree with me, please modify that...
Original comment by digi...@gmail.com
on 6 Dec 2010 at 6:25
It totally sucks that the json type changes depending on the the value of
another key. You cannot use any json library properly in non-script languages
like java or c#.
Original comment by alain.ad...@gmail.com
on 15 Jul 2013 at 8:50
Original issue reported on code.google.com by
digi...@gmail.com
on 25 Nov 2010 at 11:42