Hi!
I assume that using 'bytesresp' two times in this row bytesresp = bytesresp = Web.Contents(endpoint, [Headers=headers, Content=bytesbody, ManualStatusHandling={400}]) is not correct, because I'm having error An error occurred in the ‘’ query. Expression.Error: The name 'bytesresp' wasn't recognized. Make sure it's spelled correctly.
But when I'm using it only once - I'm having error
An error occurred in the ‘’ query. Expression.Error: The field 'IsAnomaly' of the record wasn't found.
Details:
code=BadRequest
message=AttributeError("'RequestParserV1' object has no attribute 'boundary_version'",)
during invoking this function for my time series data.
And in addition, I want to mention that before 9/26/20 my report perfectly worked with this M code:
= (table as table) => let
apikey = "my key",
endpoint = "my endpoint/anomalydetector/v1.0/timeseries/entire/detect",
inputTable = Table.TransformColumnTypes(table,{{"Timestamp", type text},{"Value", type number}}),
jsontext = Text.FromBinary(Json.FromValue(inputTable)),
jsonbody = "{ ""Granularity"": ""daily"", ""Sensitivity"": 99, ""Series"": "& jsontext &" }",
bytesbody = Text.ToBinary(jsonbody),
headers = [#"Content-Type" = "application/json", #"Ocp-Apim-Subscription-Key" = apikey],
bytesresp = Web.Contents(endpoint, [Headers=headers, Content=bytesbody]),
jsonresp = Json.Document(bytesresp),
respTable = Table.FromColumns({
Table.Column(inputTable, "Timestamp")
,Table.Column(inputTable, "Value")
, Record.Field(jsonresp, "IsAnomaly") as list
, Record.Field(jsonresp, "ExpectedValues") as list
, Record.Field(jsonresp, "UpperMargins")as list
, Record.Field(jsonresp, "LowerMargins") as list
, Record.Field(jsonresp, "IsPositiveAnomaly") as list
, Record.Field(jsonresp, "IsNegativeAnomaly") as list
}, {"Timestamp", "Value", "IsAnomaly", "ExpectedValues", "UpperMargin", "LowerMargin", "IsPositiveAnomaly", "IsNegativeAnomaly"}
),
respTable1 = Table.AddColumn(respTable , "UpperMargins", (row) => row[ExpectedValues] + row[UpperMargin]),
respTable2 = Table.AddColumn(respTable1 , "LowerMargins", (row) => row[ExpectedValues] - row[LowerMargin]),
respTable3 = Table.RemoveColumns(respTable2, "UpperMargin"),
respTable4 = Table.RemoveColumns(respTable3, "LowerMargin"),
results = Table.TransformColumnTypes(
respTable4,
{{"Timestamp", type datetime}, {"Value", type number}, {"IsAnomaly", type logical}, {"IsPositiveAnomaly", type logical}, {"IsNegativeAnomaly", type logical},
{"ExpectedValues", type number}, {"UpperMargins", type number}, {"LowerMargins", type number}}
)
in results
And it's 100% not problem with azure subscription, because my endpoint and key perfectly work here https://westus2.dev.cognitive.microsoft.com/docs/services/AnomalyDetector/operations/post-timeseries-entire-detect/console
[Enter feedback here]
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@PeterGolovatyi
Thanks for the feedback! We are currently investigating and will update you shortly.
@PeterGolovatyi Hello, just easily correct that row to
"bytesresp = Web.Contents(endpoint, [Headers=headers, Content=bytesbody, ManualStatusHandling={400}])"
It should work, I will create a PR to fix the document. Thanks.