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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
drmdodd
Frequent Visitor

Web.Contents failed to get contents from 'https://ausreman.tidywork.com/api/materials' (400)

I have tried a number of scenarios for posting data, but I have come up with nothing.  I am trying to write a power query that posts data to a REST API (https://ausreman.tidywork.com/api/materials), it posts data for materials.  The current query I have is:

 

= Json.Document(Web.Contents("https://ausreman.tidywork.com/api/materials",[Headers=
        [#"Authorization"="Basic ZZZZZZZZZZZZZZZZZ",#"Content-Type"="application/json"],
       Content=Json.FromValue({[projectId="65b6d1fe-ec2e-47c3-9c92-2aad8fdd1d26",userId="67220adb-d5cb-4667-a3ce-ebe3d6248334",materialDateUtc="2015-09-14T07:11:00",materialDate="2015-09-14T17:11:00",materialId="00000000-0000-0000-0000-000000000000",materialLocationId="1aeb9552-a3e9-4804-a7b2-641b290dac8d",materialItemCode="1H3338",materialItemId="f9be8264-81f0-4ae2-a12b-569b3e05d034",costCurrencyId="17709522-6b2e-4b01-9cdf-bb7eb0a43c52",chargeCurrencyId="17709522-6b2e-4b01-9cdf-bb7eb0a43c52",taskId="b2ffc2cf-326a-fc91-eb40-c4ddb4147a35",state="Approved",usageQuantity=1,quantity=1,cost=0.21,charge=0.25]})]), 1252)

The only thoughts I had was that it had something along the lines of the size of the data being post.   Please help me remove this frustration.

 

3 REPLIES 3

I tried applying basic authentication through power query, but I get the error:

DataSource.Error: Web.Contents with the Content option is only supported when connecting anonymously.

 

See this article:
https://community.fabric.microsoft.com/t5/Desktop/Web-Contents-with-the-Content-option-is-only-suppo...

 

Hi @drmdodd ,

 

You need to set up the privacy level of your source under data source setting as anonymous. And also make sure update your token because tokens come with a time limit.

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.