web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / C# Code for Databricks...
Power Automate
Unanswered

C# Code for Databricks API parse.

(0) ShareShare
ReportReport
Posted on by 2

Hi, I'm trying to use code from this website to parse somehow Databrick API Response. 

https://medium.com/@kyle.hale/step-by-step-connecting-to-databricks-sql-in-microsoft-power-apps-de773df5e4bf

 

Without Code enabled, everything works I got 200 response with the data that I want.

With the code below I got error. Any suggestions?

 

 

public class Script : ScriptBase

{

public override async Task<HttpResponseMessage> ExecuteAsync(){
HttpResponseMessage response = await this.Context.SendAsync(
this.Context.Request,
this.CancellationToken);

var responseString = await response.Content.ReadAsStringAsync().ConfigureAwait(
continueOnCapturedContext: false
);

var result = JObject.Parse(responseString);
var _resultSet = new List<Dictionary<string, Newtonsoft.Json.Linq.JToken>>();
var _columns = new List<string>();

foreach (var _c in result["manifest"]["schema"]["columns"]) {
_columns.Add( _c["name"].ToString()) ;
}

foreach (var _r in result["result"]["data_array"]) {
var _newRow = new Dictionary<string, Newtonsoft.Json.Linq.JToken>();
var _colIndex = 0;
foreach (var _f in _r) {
_newRow.Add(_columns[_colIndex], _f );
_colIndex++;
}
_resultSet.Add(_newRow);
}
 var y = new Dictionary<string,List<Dictionary<string, Newtonsoft.Json.Linq.JToken>>>() {
 {"results" , _resultSet } };

response.Content = CreateJsonContent(JsonConvert.SerializeObject(y));
return response;
}

}
Failed to provision compute for custom code. Request failed with error 'Code: BadRequest. Message: Unable to find an unassigned function app in 'West US'.'. The correlation Id is 'f9c88d51-fc9a-4881-a78b-7a3e99f82387'.

 

 

 

Categories:
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard