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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
efilipe
Helper IV
Helper IV

PowerBI and Socialbakers

Hi guys,

 

Can't find much about PowerBI and Socialbakers here. Socialbakers was unable to help me on their support.

 

I'm trying to call their API. I tried many ways and today I started to update a code I found here:

 

	let
    data = [ date_start= "2019-01-01",
             date_end= "2019-12-01",
             profiles= {"01234567890"},
             metrics= {"fans_lifetime"}],
    header = [  #"Authorization"="Basic TWpBek9UYzFYekddddjahsdfkaskjdfhksahdfkajsfd",
                #"Content-Type"= "application/json"],
    response = Json.Document(Web.Contents("https://api.socialbakers.com/1/facebook/metrics", [Content=Json.FromValue(data)])),
    out = Json.Document(response,1252)
in
    out

 

but I get the error:

 

 

 

Any suggestions?

 

Thanks!

 

5 REPLIES 5
karthikEdiga
Regular Visitor

Even I am facing auntentiaon issue. Its not allowing to load Powerquery

smarguin
Advocate I
Advocate I

Hello

 

Here is what works for me (connection anonymous). Note that I have used parameters (&...&). When you post on Power BI service, you will need to add to Gateway the data source and do connect anonymous for it to refresh automatically. Hope this helps.

 

let
url = "https://api.socialbakers.com/1/facebook/metrics",
body = "{ ""date_start"": "&date_start&", ""date_end"": "&date_end&", ""profiles"": ["&facebook&"], ""metrics"": [""fans_lifetime""]}",
Parsed_JSON = Json.Document(body),
BuildQueryString = Uri.BuildQueryString(Parsed_JSON),
Source = Json.Document(Web.Contents(url,
[Headers=[#"Content-Type"="application/json; charset=utf-8",
Authorization="Basic "&key&""],
Content = Text.ToBinary(body)])),
profiles = Source[profiles],
#"Converted to Table" = Table.FromList(profiles, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "data"}, {"Column1.id", "Column1.data"}),
#"Expanded Column1.data" = Table.ExpandListColumn(#"Expanded Column1", "Column1.data"),
#"Expanded Column1.data1" = Table.ExpandRecordColumn(#"Expanded Column1.data", "Column1.data", {"date", "fans_lifetime"}, {"Column1.data.date", "Column1.data.fans_lifetime"})
in
#"Expanded Column1.data1"

 

efilipe
Helper IV
Helper IV

error:

error_1.png

Hi @efilipe ,

Based on the error message, it is caused by your authentication. Please clear out the permission and re-connect again.

5.PNGClear permissions.PNGauthentication.PNG

Best Regards,

Xue Ding

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

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

What Social Backes wants:error_2.pngerror_3.png

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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