Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Multiple API calls to Jira - error

Hi,

 

not exactly sure if this can be done but this is what I'm trying to do.

I have a query that generates dates between a given period:

 

let
    StartDate = #date(prmBaseCalendarStartYear,1,1),
    EndDate = #date(prmBaseCalendarEndYear,1,10),
    NumberOfDays = Duration.Days( EndDate - StartDate ),
    Dates = List.Dates(StartDate, NumberOfDays+1, #duration(1,0,0,0)),
    #"Converted to Table" = Table.FromList(Dates, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Date"}}),
    #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Date", type date}})
in
    #"Changed Type"

 

And query returns the following result.

 

I want to call Jira API for every date and return results in a table, so I have created a function with following code:

(prmdate as date) =>
let 
    #"Source" = Json.Document((Web.Contents("https://issuetracker.site.com/jira/rest/api/2/search?jql=project=myproject+AND+issuetype+IN+(Incident,+Bug)+AND+createdDate<="&Date.ToText([prmdate],"yyyy-MM-dd")&"+AND+status+WAS+NOT+IN+('Development done', +'Ready for testing', +'In Testing', +Tested, +'Under review', +Closed)+ON+"&Date.ToText([prmdate],"yyyy-MM-dd"))))
in
    #"Source"

 

 

Invoking this function gives me the following error:

My idea was to call this function from Custom Column in Dates table and expand table for columns in response result.

Can this be done and how? 

 

Thanks in advance....

3 Replies

  • v-chuncz-msft's avatar
    v-chuncz-msft
    Community Support

    Anonymous 

     

    You may just remove square brackets.

    Date.ToText(prmdate
    • Anonymous's avatar
      Anonymous
      Not applicable

      That worked like a charm. :) Thank you!

      Any suggestions on the first part of the problem? How to fill in dates table with data retrieved by function....