Skip to main content

When I do this api request using an HTTPCaller:

https://ckan.dataplatform.nl/api/3/action/tag_show?id=enquête

I get this error:

HTTPCaller_7(HTTPFactory): Received HTTP response header: 'HTTP/1.0 400 Bad request' from 'https://ckan.dataplatform.nl/api/3/action/tag_show?id=enquête'

When I do the same request from within my browser (Chrome and Firefox), I don't get an error.

I tried adding header parameters to my request:

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip, deflate, br Accept-Language: nl,en-US;q=0.7,en;q=0.3

But this didn't work.

Something is going wrong when HTTPCaller encodes diacritics. How do I fix this?

You have two options.

Either pass the parameter values through the TextEncoder set to URL-encoding first:

Or pass them through the query string parameters in the HTTPCaller, it will do the encoding for you:


You have two options.

Either pass the parameter values through the TextEncoder set to URL-encoding first:

Or pass them through the query string parameters in the HTTPCaller, it will do the encoding for you:

Exactly this. In 2016 the body needs to be encoded too. Took me a while to find out strange API responses. Worked in test, failed in prod, no usable feedback 🙂

Reply