OpenUV api problem

Hello Abraham. Sorry if is not the place for asking this, but i found you have used. OPENUV.IO, i see that in this post.
I am trying to use this API with not good results.
I used openweather but now they have changed the API from 2.5 to 3, and now i cannot get any data.
OpenUV API share the data with Javascript and CURL commands to get the info.
when i read the curl info from outside the AI2 i can read it, but not in AI2.
I use https://reqbin.com/curl for read the curl command and i can recover the data... but not in AI2. I will appreciate any correction you can give me. I can share a image of the blocks if you wants. I double check, and i feel i am missing something. I always get bad key, but the key is fine, because i can read it OUTSIDE the AI2, so, must be the blocks.

post your curl command here.

and your blocks also. and if any error message?

Thank you @Kevinkun .

curl -X GET 'https://api.openuv.io/api/v1/uv?lat=-33.46&lng=-61.48&alt=100&dt='
-H 'x-access-token: openuv-bxxxxxxxxxxxxxx-io'

why dt has no value?

what's the responseContent? show it on a label.

This works for me:


openUV.aia (3.2 KB)
image
image

P.S. If you want to ask for a particular date, use the Clock component from the Sensors Drawer in the Designer, and the FormatDateTime block to build your dt value according to

(added to FAQ)

Thank you for replying me Abraham @ABG .... and also for KevinKun @Kevinkun
I had health issues and i couldn't reply sooner.
I do as you point in your example.
I continue having errors to connect with the data. (BUT from outside i can get the info - not from IA2)
I get error 1101 and 1111.
I used your key and mine. and with no one i can get data (i cannot receive the data i mean).
I think, Maybe is the phone, and i test with another phone. And also, nothing.


Here is the aia file.
Project_UVDATANEW.aia (3.6 KB)
Maybe is a , or a space...? But, i cannot reach the data.
By the way, In the aia file is my key. And also i cannot GET the data.

These were your blocks:

Two things were wrong:

  • supplying a dt= without a value
  • supplying a text JOIN of what should have been two separate list items

Here's my fix:

Here's what I got in my emulator:

The Not Found is probably a lookup problem, to be addressed after looking at the web responseContent.

Project_UVDATANEW (1).aia (3.6 KB)

Here's the responseContent:

Do It Result: {"result":{"ozone":316.5,"ozone_time":"2023-04-12T15:04:31.773Z","safe_exposure_time":{"st1":54,"st2":65,"st3":87,"st4":109,"st5":174,"st6":326},"sun_info":{"sun_position":{"altitude":0.642877339588677,"azimuth":1.7208591932972759},"sun_times":{"dawn":"2024-10-28T08:44:40.302Z","dusk":"2024-10-28T22:57:05.067Z","goldenHour":"2024-10-28T21:57:09.424Z","goldenHourEnd":"2024-10-28T09:44:35.945Z","nadir":"2024-10-28T03:50:52.685Z","nauticalDawn":"2024-10-28T08:13:30.179Z","nauticalDusk":"2024-10-28T23:28:15.190Z","night":"2024-10-29T00:00:43.510Z","nightEnd":"2024-10-28T07:41:01.859Z","solarNoon":"2024-10-28T15:50:52.685Z","sunrise":"2024-10-28T09:10:47.185Z","sunriseEnd":"2024-10-28T09:13:27.010Z","sunset":"2024-10-28T22:30:58.185Z","sunsetStart":"2024-10-28T22:28:18.359Z"}},"uv":3.0635,"uv_max":9.8519,"uv_max_time":"2024-10-28T15:50:52.685Z","uv_time":"2024-10-28T19:27:45.733Z"}}
---

I see no "O3".
Maybe you wanted "ozone" ?

image


Here's some ozone.
Project_UVDATANEW (2).aia (4.1 KB)

Hello Abraham.
Thank you for your help. Now works. BUT, only in 1 phone.
My error to call ozone (O3). and not using the proper description of the variable.
I still have the 1101 error. But it's in a phone with Android 6. I think it's a connection problem.
It's sad, because i use it a lot that phone. It's getting older, like me.

Again, thank your for sharing some Ozone... i was needed of Oxygen to think.
I'm in debt with you.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.