Forum Discussion

efilipe's avatar
efilipe
Icon for Helper IV rankHelper IV
6 years ago
Solved

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 d...
  • Anonymous's avatar
    Anonymous
    6 years ago

    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

    Regards,

    Xiaoxin Sheng