I am trying to create ScheduledTask in my cloud account to run the below task on a daily basis, but WolframCloud is returning an error. Am I doing something wrong with building the task?
BTW: I had to obscure sensitive detail; the task runs fine when done manually (not as a ScheduledTask).
Errors:
- CloudSubmit: Cloud Server is not able to complete a request
- CloudSubmit: --Message not Found--
task =
ScheduledTask[(dt = DateObject[Yesterday,TimeZone->"America/New_York"];
csv = Import[HTTPRequest["XXXX", <|
Method->"POST",
"Body"-><|
"query"->"SELECT latitude,longitude,trip FROM overland WHERE timestamp >= " <> ToString@UnixTime[DateObject[dt,TimeZone->"America/New_York"]]<>" AND timestamp < "<>ToString@UnixTime[DateObject[DatePlus[dt,1],TimeZone->"America/New_York"]]<>" AND wifi != 'Buehler?';"
|>
|>],"Dataset"];
If [
Length[csv]>1,
tb=Table[{GeoPosition[{csv[[a,"latitude"]],csv[[a,"longitude"]]}],csv[[a,"trip"]]},{a,Length[csv]}];
groupedData = KeySort[GroupBy[tb,Last]];
map=GeoListPlot[
Values@groupedData,
PlotLegends->Placed[Keys@groupedData,Bottom],
PlotMarkers->Point,
PlotStyle->{PointSize[0.005]},
ImageSize->{600,600},
AspectRatio->1,
GeoServer->"https://tile.openstreetmap.org/`1`/`2`/`3`.png",
GeoScaleBar->{"Imperial", "Metric"},
PlotLabel->Row[{
Style["Overland", {"Text",Bold}],
Style[" \[Bullet] "<>DateString[dt,"LocaleDateFull"],"Text"]
}],
ImageMargins->{{5,5},{10,5}}
];
URLExecute[HTTPRequest[
"XXXX", <|
Method->"POST",
"Body"->{
"authorization"->"XXXXXXXX",
"file"->BaseEncode[ExportByteArray[map,"PNG"],"Base64"],
"destination"->”xxx"
}
|>
]
]
])
,"Daily"
,TimeZone->"America/New_York"
]