0

How to format a weather API query to return CSV forecast data

I can successfully generate CSV weather API queries for current data using

https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/Villamartin, 03189, Spain/?unitGroup=metric&contentType=csv&key=*****&include=obs%2Ccurrent

I'm trying to do the same for todays forecast but it returns 400 and no further details

https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/Villamartin,%2003189,%20Spain/2021-11-05?unitGroup=metric&key=*****

How should I format the query?  If I leave the contentType=csv off the query as shown above everything works but this returns json data which I want to avoid if at all possible.  I'm trying to generate a hourly forecast for the next 12-24 hours.   I've tried putting it before or after the &key and I just get the same 400 error.  I'm using a micro controller to handle the data and csv is much lower overhead for me.

Thanks in advance

2 comments

Please sign in to leave a comment.