0

API Call - one call per Month

Hi community,

it seems to be the case that my previous post was not submitted successfully. I am trying to read data through a rest api from my accounting software. However they provide only max 50 data sets per call. 

 

For multiply months there are for sure more than 50 data sets. However for one month they are for sure less than 50 entries. Therefore I want to query per Month. As per https://support.klipfolio.com/hc/en-us/articles/218946328-Data-sources-with-multiple-pages- I should use a static and a dynamic data source for this.

 

My static dataset looks like 

 

I want to send out a REST API Call per Month (per Line) to this URL: https://webapp.buchhaltungsbutler.de/api/v1/transactions/get

As per the API for /transactions/get (https://webapp.buchhaltungsbutler.de/docs/api/v1/) I can use the parameters "date_to" and "date_from" to query only a single month. I have to add those parameter to the body of the REST Call.

How can I use those values to build up my query?

 

Best,

Daniel

 

 

1 comment

  • 0
    Avatar
    Keely Davison

    Hi Daniel,

    Have you considered using PowerMetrics for your visualization? PowerMetrics keeps historical data for you and eliminates the need to use dynamic data source.

    I suggest you try setting up one with this data and checking it out.  Here are some links to get you started.

    https://support.klipfolio.com/hc/en-us/articles/360003734913-Introduction-to-PowerMetrics

    On the Klip side, you will need to craft the query based on the api docs as you mentioned. Test it with static values first to get it working. e.g. Try something like

    https://webapp.buchhaltungsbutler.de/api/v1/transactions/get?date_from=xxxx&date_to=yyyy 

    where you replace xxxx and yyyy with the date range you want to get. 

    Once you get data correctly the next step is to create a dynamic version of the data source and this needs a variable with a valid value created. In the Klip editor you will create a variable.   For this example I will call it daterange.  Give it the same value you used in your static test e.g date_from=xxxx&date_to=yyyy with xxxx and yyyy replaced with valid dates.

    To created the dynamic data source you will want to change the query to be something like https://webapp.buchhaltungsbutler.de/api/v1/transactions/get?{props.daterange}

    Once you have the data source created you can use MAPFLAT to access the set of months you have in the datasource you showed in your post.  Something like: 

    MAPFLAT (CONCAT("date_from=",@A:A,"&date_to=",@B:B"),"daterange",@X:X)  where @X:X is data from the dynamic data source you created. 

    I would recommend changing the format of the dates in your datasource to match what the api requires, e.g. yyyy-MM-dd, so that you do not have to do additional date manipulation in the MAPFLAT formula. 

    Note: this is creating a separate instance for each start and end date combination so we would not recommend getting more than about 12 months or 12 instances of data.

    I know this is lots of information to digest, if needed reach out to support@klipfolio.com and we can help you on a ticket.

    Keely

     

Please sign in to leave a comment.