Back to all

Is the octopus query syntax correct in your PowerBi Example?

I tried to test this using PowerQuery in Excel, I don't currently have PowerBI but assume the PowerQuery is the same in both cases.

I was getting errors using your example in step 7 on https://developer.maximizer.com/v2/docs/maximizer-and-powerbi

However the image in step 8 gives clues to the issues.

I think the body variable has to issues one too many { and all double quotes " inside the query need to be doubled "".

After making these changes it worked for me in Excel, the whole PowerQuery query was


let
url = "https://api.maximizer.com/octopus/OpportunityRead",
body = "{
opportunity: {
criteria: {
searchQuery: {
""CreationDate"":{
""$GE"":""2023-01-01T12:00:00""
}
},
},
scope: {
fields: {
""CloseDate"": 1,
""Key"": 1,
""CorporateRevenue"": 1,
""Leader"":
{
uid: 1,
displayValue: 1
},
abEntry:{
key: 1,
displayValue: 1,
lastModifyDate: 1
},
}
},
orderBy:{
fields:[
""CloseDate""
]
}
},
configuration: {
drivers: {
IOpportunitySearcher: ""Maximizer.Model.Access.Sql.OpportunitySearcher""
}
}}",
Source = Json.Document(
Web.Contents(
url,
[Headers = [Authorization = "Bearer "],
Content = Text.ToBinary(body)]
)
)
in
Source