Is anyone using the DomoApi?
I was not sure where to post this question but "New to Domo" seemed as good as any- I did not see a board for DomoApi or SDK. If there is anyone out there that is using the DomoApi and c#, I could really use some help. here is my code, and question:
public async void GetPayPalSettlementFiles()
{
String DataSetID = "687752-c514-4bf5-96e4-a0f4c7fed4";//PayPalSettlementFiles
var query = new DataQueryRequest();
query.AddColumn("FileName");
query.AddColumn("StartDate");
query.AddColumn("EndDate");
query.AddColumn("RowCount");
try
{
DataQueryResponse qr = await client.DataSets.QueryDataSetAsync(DataSetID, query);
Console.Out.WriteLine(qr.ColumnCount.ToString() + " Columns Returned");
Console.Out.WriteLine(qr.RowCount.ToString() + " Rows Returned");
var xlist = from a in qr.Data
where a[0].ToString().Equals(" ")
select new
{
};
foreach (var FileDef in from fd in qr.Data
select fd)
{
FilesProcessed.Add(
new FileDefinition
{
FileName = FileDef[0].ToString(),
StartDate = FileDef[1].ToString(),
EndDate = FileDef[2].ToString(),
RowCount = Convert.ToInt16(FileDef[3])
});
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
-ugh, lost the formatting when it pasted in-
The idea here is to retrieve the list of paypal settlement statements that we have loaded into Domo. If I comment out the last query field, the code works perfectly and I get the list of files and they load into the list. adding the "RowCount" column throws an exception when it hits QueryDataSetAsync:
System.Net.Http.HttpRequestException was caught
HResult=-2146233088
Message=Response status code does not indicate success: 400 (Bad Request).
Source=System.Net.Http
StackTrace:
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at DomoApi.DomoClient.<PostAsync>d__1f`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at DomoApi.Manager.DataSetsManager.<QueryDataSetAsync>d__9a.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at DomoApi.Manager.DataSetsManager.<QueryDataSetAsync>d__96.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at ConsoleApplication1.Program.<GetPayPalSettlementFiles>d__2a.MoveNext() in d:\apps\Custom Utilities\ConsoleApplication1\ConsoleApplication1\Program.cs:line 224
InnerException:
All I can think of is that I can't ask for the last column in the dataset. Once I get this working, I will post the entire program here. The overall code should eventually read in the list of statements from Domo. get the list of files we have received from PayPal, check each one to see if they have been processed, if not, load the detail into a list<>, serialize it and push it into the payment details data set and finally add the filename to the list of processed files.
I could, of course, simply use the code to clean up the statements and write them out to a CSV file to read in through workbench, but that seems silly when I already have to write code to clean up the files, why not load the data from memory instead?
Comments
-
It turns out that the "RowCount" column in the Domo data set was actually " RowCount" (with the leading space). Many thanks to Matt for pointing that out, I doubt I would have found that for days. So getting the data out is pretty easy - just make sure your column names match the actual names in the data set ?
The Code below should work for you as a go-by.
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 731 Beast Mode
- 55 App Studio
- 40 Variables
- 682 Automate
- 175 Apps
- 451 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 122 Manage
- 119 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 107 Community Announcements
- 4.8K Archive