Good morning. I have a simple HTTP GET request retrieving metal pricing information for a given date range. Here is the test URL returning the data that I want (3 days for testing purposes) and here is my flow shown below. What I have is:
[{"id":"d07a7fc39c33bb35","type":"http request","z":"afad840914e83550","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://metals-api.com/api/timeseries?access_key=ns48wfzhxnaciy7u7yv1r4fd9wk7usx7gj50zq5zjo42w0le9yra4e7ldqb6&base=USD&symbols=LME-NI&start_date=2022-01-15&end_date=2022-01-17","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"headers":[],"x":790,"y":2060,"wires":[["64590608867eba88"]]},{"id":"5e0fd3b289f67476","type":"inject","z":"afad840914e83550","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":660,"y":2000,"wires":[["d07a7fc39c33bb35"]]},{"id":"08c2755f20cd76b9","type":"debug","z":"afad840914e83550","name":"Metals_API_Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1110,"y":2180,"wires":[]},{"id":"64590608867eba88","type":"change","z":"afad840914e83550","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rates","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":2120,"wires":[["08c2755f20cd76b9"]]}]
and what I want is:
array[3]
0: object
date: 2022-01-15
LMI-NI: 1.4084257852516
1: object
date: 2022-01-16
LMI-NI: 1.4073423699781
2: object
date: 2022-01-17
LMI-NI: 1.4074267919475
I have tried various JSONata expressions and attempted a function to create the array, but I am still not seeing the way to use the names of Object0, Object1, Object2 (which in this case are dates) to be included in the array as dates.
Thank you in advance for any pointers.
EDIT: My URL returned "The maximum allowed amount of monthly API requests has been reached." because well, I have exceeded the allowed amount! I have deleted the URL above, but still hoping someone can help me out. Below is what was being returned (prior to the message about exceeding the amount)...
{
"success": true,
"timeseries": true,
"start_date": "2022-01-15",
"end_date": "2022-01-17",
"base": "USD",
"rates": {
"2022-01-15": {
"LME-NI": 1.4084257852516,
"USD": 1
},
"2022-01-16": {
"LME-NI": 1.4073423699781,
"USD": 1
},
"2022-01-17": {
"LME-NI": 1.4074267919475,
"USD": 1
}
}
}