<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Javascript fetch]]></title><description><![CDATA[<p dir="auto">I am trying to fetch the windy data, but get an error;<br />
Unexpected token W in JSON at position 0<br />
at /node_modules/node-fetch/lib/body.js:48:31<br />
at processTicksAndRejections (internal/process/task_queues.js:97:5) {<br />
name: 'FetchError',<br />
message: 'invalid json response body at <a href="https://api.windy.com/api/point-forecast/v2" rel="nofollow ugc">https://api.windy.com/api/point-forecast/v2</a> reason: Unexpected token W in JSON at position 0',<br />
type: 'invalid-json'</p>
<p dir="auto">What could be the problem in my script?</p>
<pre><code>let _data = { 
"lat": 52.046,
"lon": 4.447,
"model": "iconeu",
"parameters": ["wind"],
"levels": ["surface"],
"key": "..."};
</code></pre>
<p dir="auto">fetch("<a href="https://api.windy.com/api/point-forecast/v2" rel="nofollow ugc">https://api.windy.com/api/point-forecast/v2</a>", {<br />
method: 'POST',<br />
body: _data,<br />
headers: {"Content-type": "application/json; charset=UTF-8"}<br />
})<br />
.then(response =&gt; response.json())<br />
.then(Server =&gt; {<br />
console.log(Server) // Prints result from <code>response.json()</code><br />
//    var UvNow = Server.result.uv;//Processing  UVToday<br />
//    BLApp.apiPut("UvNow/"+UvNow);//Updating better logic variable UVToday<br />
})<br />
.catch(error =&gt; console.error(error))<br />
//   OpenUvServer  = false<br />
//   var StandardProcessing = false<br />
//    console.log("i is: " +i)</p>
]]></description><link>https://community.windy.com/topic/14333/javascript-fetch</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Mar 2026 17:27:33 GMT</lastBuildDate><atom:link href="https://community.windy.com/topic/14333.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 16 Nov 2020 09:54:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Javascript fetch on Wed, 18 Nov 2020 16:02:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/marcelklim" aria-label="Profile: Marcelklim">@<bdi>Marcelklim</bdi></a> said in <a href="/post/62083">Javascript fetch</a>:</p>
<blockquote>
<p dir="auto">fetch("<a href="https://api.windy.com/api/point-forecast/v2" rel="nofollow ugc">https://api.windy.com/api/point-forecast/v2</a>", {<br />
method: 'POST',<br />
body: _data,<br />
headers: {"Content-type": "application/json; charset=UTF-8"}<br />
})</p>
</blockquote>
<p dir="auto">You should try <code>body: JSON.stringify(_data)</code></p>
]]></description><link>https://community.windy.com/post/62550</link><guid isPermaLink="true">https://community.windy.com/post/62550</guid><dc:creator><![CDATA[vicb]]></dc:creator><pubDate>Wed, 18 Nov 2020 16:02:10 GMT</pubDate></item><item><title><![CDATA[Reply to Javascript fetch on Wed, 18 Nov 2020 11:56:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/marekd" aria-label="Profile: marekd">@<bdi>marekd</bdi></a></p>
<p dir="auto">thx, but i changed the key efore posting avoiding abuse of my key. at this moment i still can't get the fetch done. the plugin is webbased? I try to get it done with javascript on a computer</p>
]]></description><link>https://community.windy.com/post/62488</link><guid isPermaLink="true">https://community.windy.com/post/62488</guid><dc:creator><![CDATA[Marcelklim]]></dc:creator><pubDate>Wed, 18 Nov 2020 11:56:07 GMT</pubDate></item><item><title><![CDATA[Reply to Javascript fetch on Tue, 17 Nov 2020 13:27:55 GMT]]></title><description><![CDATA[<p dir="auto">Also, you should not publish your key for Point Forecast API. I removed it from your post. Unlike from eg. Map Forecast, Point Forecast is a server-2-server servise and it is not possible to secure your key against missusing.</p>
]]></description><link>https://community.windy.com/post/62309</link><guid isPermaLink="true">https://community.windy.com/post/62309</guid><dc:creator><![CDATA[marekd]]></dc:creator><pubDate>Tue, 17 Nov 2020 13:27:55 GMT</pubDate></item><item><title><![CDATA[Reply to Javascript fetch on Tue, 17 Nov 2020 01:53:28 GMT]]></title><description><![CDATA[<p dir="auto">You should look at the windy repository with plugin examples.</p>
<p dir="auto">Check <a href="https://github.com/windycom/windy-plugins/blob/master/examples/10-obtaining-meteorological-data/plugin.html#L57-L74" rel="nofollow ugc">this plugin</a>.</p>
]]></description><link>https://community.windy.com/post/62225</link><guid isPermaLink="true">https://community.windy.com/post/62225</guid><dc:creator><![CDATA[vicb]]></dc:creator><pubDate>Tue, 17 Nov 2020 01:53:28 GMT</pubDate></item></channel></rss>