Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
appsec
New Member

POST Request with JSON Body - Expression Error

Hi everyone,

 

There are several posts with the same issue I am having, but none of the proposed solutions are working for me.

I am doing something wrong with how I construct the body into a record - which is why I am getting the expression error: We cannot convert a value of type Record to type Number.

I have tried constructing my body directly into a record, and then using Json.FromValue(body), but that doesn't work either.

I have included my code snippets for trying Json.FromValue(body) as well as Text.ToBinary(body)

 

I am using the the snyk api and this specific endpoint:

Snyk API · Apiary

 

Any help would be awesome!!

 

 

 

let
    url = "https://api.snyk.io/api/v1/reporting/issues/latest?page=1&perPage=100&sortBy=issueTitle&order=asc&groupBy=issue",
    body = "
            {
            ""filters"":{
                ""orgs"": [""d6dsfdk-df4d-4dd4-add9-fcfoobar5dac7acb""]
                        }
            }
    ",
    Source = Json.Document(Web.Contents(url),[
        Headers = [#"Content-Type"="application/json",#"Authorization"="token foobar-foobar-foobar-foobar-foobar"],
        Content = Text.ToBinary(body)
    ])
in
    Source

 

 

 

 

let
    url = "https://api.snyk.io/api/v1/reporting/issues/latest?page=1&perPage=100&sortBy=issueTitle&order=asc&groupBy=issue",
    body = [
	filters = [
                orgs = "ddfed-dfdsf-dfds-dfds-dfdsfd"
                  ]    
            ]
    ,
    Source = Json.Document(Web.Contents(url),[
        Headers = [#"Content-Type"="application/json",#"Authorization"="token foobar-foo-foo-foo-foobar"],
        Content=Json.FromValue(body)
    ])
in
    Source

 

 

1 REPLY 1
lbendlin
Super User
Super User

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors