Topic: Batch work for every unit in the system through low level API call
How can I do batch work for every unit in the system?
I'm trying to build the query string like this in Julia - code is very similar to python -
function batch_events(plates; week=43, year=2023) sid = ssid() monday = Dates.firstdayofweek(Week(week) + Date(Year(year))) sunday = Dates.lastdayofweek(Week(week) + Date(Year(year))) start = datetime2unix(monday |> DateTime) |> Int32 stop = datetime2unix(sunday |> DateTime) |> Int32 detectors = [ Dict(:type => "trips", :filter1 => 0) ] items2load =  for plate in plates push!(items2load, Dict(:svc => "events/load", :params => Dict( :ivalType => 1, :itemId => plates2ids[plate], # I have a map from plates to your internal IDs :timeFrom => start, :timeTo => stop, :detectors => detectors ) ), Dict(:svc => "events/get", :params => Dict( :selector => Dict( :type => "*", :timeFrom => start, :timeTo => stop, ), ) ) ) end items2load = JSON3.write(items2load) |> HTTP.escapeuri svc = "[url]https://hst-api.wialon.com/wialon/ajax.html?svc=core/batch[/url]" url = svc * "¶ms=$items2load" * "&sid=$sid" response = HTTP.post(url) payload = JSON3.read(response.body) end
If call the function with the first two units like so
events = batch_events(plates[1:2]; week=43, year=2023)
It seems to be loading the events into session. But I'm not getting the actual data, although I've intercalated
In the image attached you can see a JSON crack image of the data I get