Illegal character in query error

Hi all, I have been pulling data from FRED that was possible through the community’s help in this thread. However, I am facing an error -

ERROR GET Request 3:1 Execute failed: java.lang.IllegalArgumentException: Illegal character in query at index 122: https://api.stlouisfed.org/fred/series/observations?series_id=M2SL&api_key=xxxxxxxxx&file_type=json

All other data can be pulled without any issue, only this series si causing problems. Any help?

Have you tried running the query in another tool (Postman, Python,…) for comparison?
br

The query returns fine in the Chrome browser. Not to mention, I have several other queries with different IDs.

You could use this workflow and avoid json entirely.

1 Like

I guess character at position 122 is somewhere in your API key. In contrast to web browser our nodes do not perform automated encoding of URLs. Therefore you have to make sure that the URL you provide only contains valid characters and characters that not valid in a URL (or the query part in this particular case) are encoded upfront.

1 Like

You were right, but it was an extra space at the end of the whole URL. I guess it happened during copy-pasting. Thanks.

I saw that earlier. Tbh, json API is a lot easier and universally available.