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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
artikrh
New Member

POST requests in M Language without any parameters

Hi, I have this REST API endpoint which expect a HTTP POST request in order to download a CSV file.

 

However, the issue with PBI here is that this POST request does not have/expect any parameter as input, and in order to denote a POST request in M language according to some previous threads, I have to specify Content = Text.ToBinary("") within Web.Contents to let PBI know it's a POST and not GET.

 

Unfortunately, this just triggers another error:

DataFormat.Error: We found extra characters at the end of JSON input.
Details:
Value=,
Position=8

 

If I remove this line (therefore script does a GET request), for some reasons I get an "Access to resource is forbidden" message (for this particular API call, for the ones with GET expected it works just fine).

 

How can I proceed further with this "extra character" error? Many thanks in advance.

1 REPLY 1
Anonymous
Not applicable

Hi  @artikrh ,

Are you trying to connect to one REST API? If yes, could you please provide the related REST API info? And the following is the thread which has the similar problem as yours, hope it can also help you solve the problem.

DataFormat.Error: We found extra characters at the end of JSON input


It should be #"Authorization" in Headers 

let
    Source = Json.Document(Web.Contents("xxx", 
    [
        RelativePath = "xxx",
        Content=Text.ToBinary(""),
        Headers=[#"Content-Type"="application/json", 
        #"Authorization"="Bearer xxx"
        ]  
    ]))
    
in
    Source

Best Regards

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.