Author Topic: API Weatherlink live  (Read 452 times)

0 Members and 1 Guest are viewing this topic.

Offline ich74

  • Member
  • *
  • Posts: 8
API Weatherlink live
« on: March 10, 2024, 05:46:01 AM »
Hello,
I'm having an issue with API query with Weatherlink.
The following is displayed:
“Call timestamp parameter “t” is deprecated. The timestamp you specify must be within a range that is plus or minus 300 seconds of the API server's internal clock."
what is wrong? Thanks

There is 9:50 but in really its 10:50

 [ You are not allowed to view attachments ]
« Last Edit: March 10, 2024, 05:53:14 AM by ich74 »

Offline mcrossley

  • Forecaster
  • *****
  • Posts: 1140
    • Wilmslow Astro
Re: API Weatherlink live
« Reply #1 on: March 10, 2024, 06:22:24 AM »
The "t" parameter (which as the API says was deprecated some time ago, read the API docs for the new, much simpler way of calling the API) is a UNIX timestamp, so represents a UTC time. It sounds like you are sending local time masquerading as a timestamp?
Mark

Offline ich74

  • Member
  • *
  • Posts: 8
Re: API Weatherlink live
« Reply #2 on: March 10, 2024, 06:29:23 AM »
hello,
i taked this:
https://api.weatherlink.com/v2/stations?api-key={YOUR API KEY}
is there a better way?

Offline johnd

  • Forecaster
  • *****
  • Posts: 4853
    • www.weatherstations.co.uk
Re: API Weatherlink live
« Reply #3 on: March 10, 2024, 06:33:35 AM »
Are you looking at old documentation somehow? The old signature is no longer necessary at all. And there is no time element in the call to the /stations endpoint. But you do need to pass x-api-secret in the header (but not as a query parameter)

Prodata Weather Systems
Prodata's FAQ/support site for Davis stations
Includes many details on 6313 Weatherlink console.
UK Davis Premier Dealer - All Davis stations, accessories and spares
Cambridge UK

Sorry, but I don't usually have time to help with individual issues by email unless you are a Prodata customer. Please post your issue in the relevant forum section here & I will comment there if I have anything useful to add.

Offline ich74

  • Member
  • *
  • Posts: 8
Re: API Weatherlink live
« Reply #4 on: March 10, 2024, 06:34:52 AM »

Offline johnd

  • Forecaster
  • *****
  • Posts: 4853
    • www.weatherstations.co.uk
Re: API Weatherlink live
« Reply #5 on: March 10, 2024, 06:38:31 AM »
i am looking here
https://weatherlink.github.io/v2-api/tutorial

But that does not say anything about a time parameter. (Maybe you are not sending any time value, but it's merely a misleading error message?) It says:

To make the API call to the /stations API endpoint you need to make an HTTP GET API call to the following URL and include a header named X-Api-Secret set to the value of your API Secret.
« Last Edit: March 10, 2024, 06:57:45 AM by johnd »
Prodata Weather Systems
Prodata's FAQ/support site for Davis stations
Includes many details on 6313 Weatherlink console.
UK Davis Premier Dealer - All Davis stations, accessories and spares
Cambridge UK

Sorry, but I don't usually have time to help with individual issues by email unless you are a Prodata customer. Please post your issue in the relevant forum section here & I will comment there if I have anything useful to add.

Offline ich74

  • Member
  • *
  • Posts: 8
Re: API Weatherlink live
« Reply #6 on: March 10, 2024, 07:27:29 AM »
yes, i copied in my key and secret. think the problem ist, that the station have an other time than the real time. there is a difference von one hour

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: API Weatherlink live
« Reply #7 on: March 10, 2024, 07:40:39 AM »
yes, i copied in my key and secret. think the problem ist, that the station have an other time than the real time. there is a difference von one hour

There is no need anymore to use the t=value parameter.
It still works and I assume entering a wrong value, such as local time,  will make the URL invalid.
But if you use the t=value   you should make sure to use the UTC-time-value
Not your local clock value in Germany which is indeed 1  hour earlier then the UTC time.

The URL as it is used currently:
Code: [Select]
https://api.weatherlink.com/v2/current/111111?api-key=_API_SETTING_The header for this URL:
Code: [Select]
X-Api-Secret:_secret_I assume you are reading an old version of the API-documentation.
Attached a screenshot of how it should look today.

Wim


« Last Edit: March 10, 2024, 07:47:52 AM by wvdkuil »

Offline ich74

  • Member
  • *
  • Posts: 8
Re: API Weatherlink live
« Reply #8 on: March 10, 2024, 07:47:48 AM »
this is my url
https://api.weatherlink.com/v2/current/{station-id}?api-key={YOUR API KEY}
i fill out id and key
 [ You are not allowed to view attachments ]
 [ You are not allowed to view attachments ]
 [ You are not allowed to view attachments ]
« Last Edit: March 10, 2024, 07:52:55 AM by ich74 »

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: API Weatherlink live
« Reply #9 on: March 10, 2024, 07:54:24 AM »
this is my url
https://api.weatherlink.com/v2/current/{station-id}?api-key={YOUR API KEY}
i fill out id and key

But did you include the "secret" value in your header when sending the URL?
Code: [Select]
X-Api-Secret:_secret_Please post the exact code lines you are using so we can take a look.

Wim


Offline mcrossley

  • Forecaster
  • *****
  • Posts: 1140
    • Wilmslow Astro
Re: API Weatherlink live
« Reply #11 on: March 10, 2024, 07:58:23 AM »
Are you just putting that URL into a browser?

If so, you cannot do that, you need to set a header in the GET that is sent to server, you will need to do that in code, or by using something like "curl" on Linux.
Mark

Offline ich74

  • Member
  • *
  • Posts: 8
Re: API Weatherlink live
« Reply #12 on: March 10, 2024, 08:01:45 AM »
The background is that I need a URL from which the Davis data can be retrieved remotely. thought this could be done with api

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: API Weatherlink live
« Reply #13 on: March 10, 2024, 08:05:08 AM »
The background is that I need a URL from which the Davis data can be retrieved remotely. thought this could be done with api

Yes, it can but not in a browser directly.
Only with a small script on your webserver.

Offline ich74

  • Member
  • *
  • Posts: 8
Re: API Weatherlink live
« Reply #14 on: March 10, 2024, 08:06:48 AM »
oK. Thanks. I won't be able to do that then. Thanks anyway


Offline johnd

  • Forecaster
  • *****
  • Posts: 4853
    • www.weatherstations.co.uk
Re: API Weatherlink live
« Reply #15 on: March 10, 2024, 08:10:18 AM »
The background is that I need a URL from which the Davis data can be retrieved remotely. thought this could be done with api

The API works fine but it is intended for access to the weatherlink.com data by programs that you have written. As Mark says, you cannot use the URL directly in a browser.

If you want a simpler tool to use then you could try Postman or, if you are using Visual Studio Code as your code editor then the Thunder extension works well - personally I prefer Thunder.
Prodata Weather Systems
Prodata's FAQ/support site for Davis stations
Includes many details on 6313 Weatherlink console.
UK Davis Premier Dealer - All Davis stations, accessories and spares
Cambridge UK

Sorry, but I don't usually have time to help with individual issues by email unless you are a Prodata customer. Please post your issue in the relevant forum section here & I will comment there if I have anything useful to add.

Offline mcrossley

  • Forecaster
  • *****
  • Posts: 1140
    • Wilmslow Astro
Re: API Weatherlink live
« Reply #16 on: March 10, 2024, 06:20:44 PM »
If you want a simpler tool to use then you could try Postman or, if you are using Visual Studio Code as your code editor then the Thunder extension works well - personally I prefer Thunder.
But Davis do supply a Postman collection to get you going with the basics quite quickly.
Mark

Offline johnd

  • Forecaster
  • *****
  • Posts: 4853
    • www.weatherstations.co.uk
Re: API Weatherlink live
« Reply #17 on: March 10, 2024, 07:02:57 PM »
But Davis do supply a Postman collection to get you going with the basics quite quickly.

Sure, Thunder is actually pretty similar but simpler IMO, so it's fairly easy to copy the Postman settings across to Thunder. But sure either will do fine.
Prodata Weather Systems
Prodata's FAQ/support site for Davis stations
Includes many details on 6313 Weatherlink console.
UK Davis Premier Dealer - All Davis stations, accessories and spares
Cambridge UK

Sorry, but I don't usually have time to help with individual issues by email unless you are a Prodata customer. Please post your issue in the relevant forum section here & I will comment there if I have anything useful to add.

 

anything