<?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[I&#x27;m new to api work, urgent help, is the api key or the url wrong?]]></title><description><![CDATA[<p dir="auto">I want to print the weather of a certain place coming from windy in Winform using the paint forecast API, but I see that there is an error in the url or apikey (</p><pre>Cannot GET /api/point-forecast/v2</pre>) I am sharing my code, urgent help.   public partial class Frmsettings : Form<br />
{<p></p>
<pre><code>    private Timer dataFetchTimer;
    private static readonly HttpClient client = new HttpClient();

    public Frmsettings()
    {
        InitializeComponent();
        // Timer ayarlarını yapıyoruz
        dataFetchTimer = new Timer();
        dataFetchTimer.Interval = 60000; // 60 saniyede bir veri çekme (1000ms * 60)
        dataFetchTimer.Tick += DataFetchTimer_Tick;  // Timer tetiklendiğinde bu fonksiyon çalışacak
        MessageBox.Show("Timer interval set to: " + dataFetchTimer.Interval);  // Interval'in doğru ayarlandığını kontrol edin
        dataFetchTimer.Start();  // Timer'ı başlat

    }

    // Timer her tetiklendiğinde API'den veri çekme
    private async void DataFetchTimer_Tick(object sender, EventArgs e)
    {
        MessageBox.Show("Timer Triggered!");  // Bu mesaj görünüyor mu?
        await FetchWeatherData();  // Veriyi çekme işlemini başlat
      
    }

    private async Task FetchWeatherData()
    {
        string apiKey = "HcuoyBroUc8HeHz4ITN64JgnTAgHSCbY";  // Windy API anahtarınız
        double latitude = 40.091;  // Enlem
        double longitude = 33.409;  // Boylam

        // API URL'sini yazdırma
        string url = $"https://api.windy.com/api/point-forecast/v2?lat={latitude}&amp;lon={longitude}&amp;model=gfs¶meters=wind&amp;levels=1000,500,250&amp;key={apiKey}";

        // Mesajları UI thread'de göstermek
        this.Invoke((MethodInvoker)delegate
        {
            MessageBox.Show("API URL: " + url);  // URL'yi yazdırın
        });

        try
        {
            // API'ye istek gönderme
            HttpResponseMessage response = await client.GetAsync(url);

            // Yanıtın durumu
            if (!response.IsSuccessStatusCode)
            {
                this.Invoke((MethodInvoker)delegate
                {
                    MessageBox.Show($"Error: {response.StatusCode} - {response.ReasonPhrase}");
                });
                return;
            }

            string responseBody = await response.Content.ReadAsStringAsync();
            this.Invoke((MethodInvoker)delegate
            {
                MessageBox.Show("API Response Body: " + responseBody);  // Yanıtı yazdır
            });

            // JSON verisini işleme (örneğin, rüzgar hızı ve yönü)
            var weatherData = JsonConvert.DeserializeObject(responseBody);
            this.Invoke((MethodInvoker)delegate
            {
                MessageBox.Show($"Deserialized Data: {weatherData}");  // Deserialize edilmiş veriyi yazdır
            });

            if (weatherData != null &amp;&amp; weatherData.wind != null &amp;&amp; weatherData.wind.Length &gt; 0)
            {
                this.Invoke((MethodInvoker)delegate
                {
                    MessageBox.Show($"Wind Speed: {weatherData.wind[0].speed} m/s");
                    MessageBox.Show($"Wind Direction: {weatherData.wind[0].direction} degrees");
                });
            }
            else
            {
                this.Invoke((MethodInvoker)delegate
                {
                    MessageBox.Show("Wind data not available");
                });
            }
        }
        catch (HttpRequestException ex)
        {
            this.Invoke((MethodInvoker)delegate
            {
                MessageBox.Show($"Error: {ex.Message}");
            });
        }
    }



    // JSON cevabını işlemek için sınıf
    public class WeatherResponse
    {
        public WindData[] wind { get; set; }
    }

    public class WindData
    {
        public double speed { get; set; }
        public double direction { get; set; }
    }


    //Kalecik enlem boylam
    //40.080, 33.404
    private void Frmsettings_Load(object sender, EventArgs e)
    {
        // Bu mesajı görüp görmediğinizi kontrol etmek için kullanabilirsiniz
        MessageBox.Show("Form Loaded!");  // Bu mesajı görmelisiniz
        dataFetchTimer.Start();
    }
</code></pre>
]]></description><link>https://community.windy.com/topic/37690/i-m-new-to-api-work-urgent-help-is-the-api-key-or-the-url-wrong</link><generator>RSS for Node</generator><lastBuildDate>Mon, 12 Oct 2026 19:35:05 GMT</lastBuildDate><atom:link href="https://community.windy.com/topic/37690.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 26 Nov 2024 16:32:01 GMT</pubDate><ttl>60</ttl></channel></rss>