Yes, correct, I’m missing the above columns and their values. These are the individual survey questions, like how knowledgeable was the agent, how are you satisfied with the product, etc.
This is the M code I used for working with the API directly:
GetDataSurveys function:
let
Source = (Per_Page as number, Page as number) => let
URL = "https://acme.freshdesk.com/api/v2/surveys/satisfaction_ratings/?updated_since=2022-01-01&per_page=" & Number.ToText(Per_Page) & "&page=" & Number.ToText(Page),
Source = Json.Document(Web.Contents(URL)),
ConvertedToTable = try Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error) otherwise error "Failed to convert JSON to Table",
ExpandedColumn1 = if Table.IsEmpty(ConvertedToTable) then error "No data available or wrong structure" else Table.ExpandRecordColumn(ConvertedToTable, "Column1", {"id", "survey_id", "user_id", "agent_id", "feedback", "group_id", "ticket_id", "created_at", "updated_at", "ratings"}, {"id", "survey_id", "user_id", "agent_id", "feedback", "group_id", "ticket_id", "created_at", "updated_at", "ratings"}),
ExpandedRatings = Table.ExpandRecordColumn(ExpandedColumn1, "ratings", {"default_question", "question_47000081303", "question_47000081304", "question_47000081305"}, {"default_question", "question_47000081303", "question_47000081304", "question_47000081305"})
in
ExpandedRatings
in
Source
SurveysSatisfaction_ratings query:
let
GetAllPages = List.Generate(
() => [Page = 1, Source = Json.Document(Web.Contents("https://XXXX.freshdesk.com/api/v2/surveys/satisfaction_ratings?created_since=2022-01-19T02:00:00Z" & "&per_page=30" & "&page=" & Number.ToText(1)))],
each List.Count([Source]) > 0,
each [Page = [Page] + 1, Source = Json.Document(Web.Contents("https://acme.freshdesk.com/api/v2/surveys/satisfaction_ratings?created_since=2022-01-19T02:00:00Z" & "&per_page=30" & "&page=" & Number.ToText([Page] + 1)))],
each [Source]
),
ConvertToTable = Table.FromList(GetAllPages, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandListColumn(ConvertToTable, "Column1"),
ExpandColumn1 = Table.ExpandRecordColumn(#"Expanded Column1", "Column1", {"id", "survey_id", "user_id", "agent_id", "feedback", "group_id", "ticket_id", "created_at", "updated_at", "ratings"}, {"id", "survey_id", "user_id", "agent_id", "feedback", "group_id", "ticket_id", "created_at", "updated_at", "ratings"}),
ExpandedRatings = Table.ExpandRecordColumn(ExpandColumn1, "ratings", {"default_question", "question_47000081303", "question_47000081304", "question_47000081305"}, {"default_question", "question_47000081303", "question_47000081304", "question_47000081305"}),
#"Filtered Rows" = Table.SelectRows(ExpandedRatings, each [id] = 47001547786)
...