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
efilipe
Helper IV
Helper IV

Date limitation on the API

Hi guys,

 

Socialbakers has a limitation for date_start and date_end that cannot be over 3 months.

 

I want to setup the API for the whole next year, to be up and running. Do I have to use "get data" 3 times?

 

This is the code

 

let
data = [ date_start = "2019-10-01",
date_end = "2019-12-31",
profiles= {"8282828282"},
fields= {"attachments", "author_id", "comments","created_time","id","interactions","likes","message","type","url","insights_engagement","insights_impressions","insights_reach","insights_saved","insights_video_views"}
],
header = [ #"Authorization"="Basic TWpBek9UiMDExYTcxOWRkOWMwZGIwYzAxYWI2NGViMDUz",
#"Content-Type"= "application/json; charset=utf-8"],
response = Web.Contents("https://api.socialbakers.com/1/instagram/profile/posts",[Content=Json.FromValue(data),Headers=header]),
out = Json.Document(response,1252),
data1 = out[data],
posts = data1[posts],
#"Converted to Table" = Table.FromList(posts, Splitter.SplitByNothing(), null, null, ExtraValues.Ignore),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"attachments", "author_id", "comments", "created_time", "id", "interactions", "likes", "message", "type", "url", "profile_id", "insights_engagement", "insights_impressions", "insights_reach", "insights_saved", "insights_video_views"}, {"Column1.attachments", "Column1.author_id", "Column1.comments", "Column1.created_time", "Column1.id", "Column1.interactions", "Column1.likes", "Column1.message", "Column1.type", "Column1.url", "Column1.profile_id", "Column1.insights_engagement", "Column1.insights_impressions", "Column1.insights_reach", "Column1.insights_saved", "Column1.insights_video_views"}),
#"Expanded Column1.attachments" = Table.ExpandListColumn(#"Expanded Column1", "Column1.attachments"),
#"Expanded Column1.attachments1" = Table.ExpandRecordColumn(#"Expanded Column1.attachments", "Column1.attachments", {"images", "videos"}, {"Column1.attachments.images", "Column1.attachments.videos"}),
#"Expanded Column1.attachments.videos" = Table.ExpandListColumn(#"Expanded Column1.attachments1", "Column1.attachments.videos"),
#"Expanded Column1.attachments.videos1" = Table.ExpandRecordColumn(#"Expanded Column1.attachments.videos", "Column1.attachments.videos", {"url"}, {"Column1.attachments.videos.url"}),
#"Expanded Column1.attachments.images" = Table.ExpandListColumn(#"Expanded Column1.attachments.videos1", "Column1.attachments.images"),
#"Expanded Column1.attachments.images1" = Table.ExpandRecordColumn(#"Expanded Column1.attachments.images", "Column1.attachments.images", {"url"}, {"Column1.attachments.images.url"})
in
#"Expanded Column1.attachments.images1"

 

Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @efilipe ,

You can try to create a table to manually pagination your API to invoke this API multiple times with different parameters and merge them to one to get full records.

Below is a custom function to use start, end date to generate a splittable:

let
    fxGeTable=(start as date,end as date) =>
    let
        range=Duration.Days(end-start),
        ConvertToTable=Table.FromList(List.Numbers(1,range/90),Splitter.SplitByNothing(), {"Index"}, null, ExtraValues.Error),
        addStart=Table.AddColumn(ConvertToTable,"Start",each Date.AddDays(start,([Index]-1)*90)),
        addEnd=Table.AddColumn(addStart,"End",each if end>= Date.AddDays([Start],89) then Date.AddDays([Start],89) else end ),
        result=Table.TransformColumnTypes(addEnd,{{"Index",type number},{"Start",type date},{"End",type date}})
    in
        result
in
    fxGeTable

7.png

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

HI @efilipe ,

You can try to create a table to manually pagination your API to invoke this API multiple times with different parameters and merge them to one to get full records.

Below is a custom function to use start, end date to generate a splittable:

let
    fxGeTable=(start as date,end as date) =>
    let
        range=Duration.Days(end-start),
        ConvertToTable=Table.FromList(List.Numbers(1,range/90),Splitter.SplitByNothing(), {"Index"}, null, ExtraValues.Error),
        addStart=Table.AddColumn(ConvertToTable,"Start",each Date.AddDays(start,([Index]-1)*90)),
        addEnd=Table.AddColumn(addStart,"End",each if end>= Date.AddDays([Start],89) then Date.AddDays([Start],89) else end ),
        result=Table.TransformColumnTypes(addEnd,{{"Index",type number},{"Start",type date},{"End",type date}})
    in
        result
in
    fxGeTable

7.png

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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
Top Kudoed Authors