Forum Discussion
tthierry
7 years agoFrequent Visitor
API Calls from column
Hi So here is the challenge, I have an API in the format https://api.workflowmax.com/job.api/get/[id]/customfield?apiKey=[apiKey]&accountKey=[accountKey] The ID changes for each job and jobs ...
- 7 years ago
Hi tthierry,
I've tried this earlier. You need to follow below logic:
let ... PreviousStep = ... , Step = Table.AddColumn(PreviousStep, "NewColumnName", each Json.Document(Web.Contents("https://api.workflowmax.com/job.api/get/" & [id] & "/customfield?apiKey=[apiKey]&accountKey=[accountKey]"))), in Step
Regards,
Ruslan
-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!
tthierry
7 years agoFrequent Visitor
Thank you so much. I had to tweak it but it worked. The tweak was to use "each" instead of
each Json.Document
Sorry for only accepting the answer now, I was working on other things in tyhe mean time. Thanks a lot.
zoloturu
7 years agoMemorable Member
- Anonymous6 years agoNot applicable
I Am also trying a similar scneario where i want to get output of API as a column in a new table.
let Source = Table.SelectColumns(#"Sub Tasks",{"JIRAID"}), WorklogUrl = "https://jira.company.com/rest/api/2/issue/", GetJson = (Url) => let RawData = Web.Contents(Url), Json = Json.Document(RawData) in Json, GetWorklog = (JIRAID as text) => let Url = WorklogUrl & [JIRAID] & "/worklog", Json = GetJson(Url), WorkLog = Json[#"worklogs"] in WorkLog, JiraWorklog = Table.AddColumn(GetWorklog, "Worklog", each GetWorklog() ) in JiraWorklogBut i get this error at last step
Expression.Error: We cannot convert a value of type Function to type Table. Details: Value=[Function] Type=[Type]