11 May
2017
11 May
'17
09:37
Hi,
I've been have some troubles using the groovy http builder to queue a download. I've eventually realised that what is happening is that the GBIF API is returning a download key as a simple text string but setting the content type to application/json. This causes difficulties with the http builder, since by default it tries to be helpful and parse the result as JSON. It then throws an exception, since it tries to interpret something like 0065397-160910150852091 as a number. (The /occurrence/count path also just returns a count, but this is correctly interpreted as just being an integer.)
I've worked around this problem, but could future versions of the API always return valid JSON for application/json content?
Doug