List of API Call - Get: How to Present / Pull

Hi,
New user and this question might be very trivial -
I am pulling a list of timezones from a World Time API. It's a GET and it works great in Postman.
Now, in ReTool, what I would like to do is that the user can choose from a drop-down menu, an option from that list.
I tried to add a drop-down or list component and connect is using Mapped to the query, but getting The selected data source is empty or could not be converted to an array." error (it is not empty - in the Preview, it is giving me back the response of all the locations.
Any idea / solution?

Thanks in advance

Wait! I am using Select and it is working!
Now just need to figure out if I can search through it with some sort of "Autocomplete"..

Fuzzy match does the job!
Thanks everyone!

2 Likes

Wonderful! :raised_hands:

@Tess while I have your attention, maybe you can help me with some time format I am stuck with..

This API, WorldTimeAPI, is supposed to give a response in time. The general output should be:
{
"fromTimezone": "Africa/Addis_Ababa",
"fromDateTime": "2021-03-14T17:45:00",
"toTimeZone": "Africa/Asmera",
"conversionResult": {
"year": 2021,
"month": 3,
"day": 14,
"hour": 17,
"minute": 45,
"seconds": 0,
"milliSeconds": 0,
"dateTime": "2021-03-14T17:45:00",
"date": "03/14/2021",
"time": "17:45",
"timeZone": "Africa/Asmera",
"dstActive": false
}
}
For the POST - so, once I give the location of origin, location of destination and time at origin, I can get the time at destination.

Now, I have 1 issues:
(1) I only need the "time" at the response. I am using {{Time_At_Destination.data.time}}. I am using the "Time" component, and at the "default value" putting this {{time_at_destination.data.time}}. I have also added in the "Success" handle for the Querty, to "Control component" of this "time" component.
What happens - it does not seem to be affected at all. Not sure what I am doing wrong.
(2) Second issue I have, is that this POST is in need of a timestamp which looks like this:
Value: String - an ISO8601-valid string representing the current, local date/time.
Now, I don't know how to translate the input of the user of "time" component to this string - the user will choose the time in terms of hours and minutes, but how do I change this to the "now" of the current date? I am not sure

I hope I did not overwhelm - maybe it's an easy one,..

Thanks

Dori

Hi

It looks like time is a property within the conversionResult object. Does {{Time_At_Destination.data.conversionResult.time}} work?

You should be able to use the moment() library for date and time manipulation (more info in our docs: https://docs.retool.com/docs/time-zones#use-dates-and-times-in-tables-and-other-components).

In your example, you may want to use the suggestion here to combine the date & time. Then, you can use moment's .toISOString()

Yes! Thank you @Tess