❔ project help
Basically I made an api in Python I figured out how to import its contents through some conversion to JSON and some Http request and stuff idek I just copied and pasted it lol, Anyways the point is I want to know if its possible in C# WPF to check if theres data and add a column with the data until theres no more data to add
8 Replies
You have a python-made API that uses JSON.
You want to know if using C# and WPF, you can check "if there is data" and "add a column with the data until there is no more data to add".
To solve the "if there is data", yes you can make HTTP requests from C# using
HttpClient
.
To solve the second question, thats harder, because there are very many unknowns here.
First, did you mean row instead of column? Also, what controls are you using to display this data?
second, "until there is no more data to add" depends on a few things. Should the WPF app show ALL the data from the python API? Can the user add things to the grid themself? Will that data be sent to the API?Yes I meant rows instead of colums, something like a ListView
For the second, I assume it would be an easy if else
If theres more data continue
If not stop
is your python API paginated?
how does it communicate "more data available"?
My api is static so its not grabbing information anywhere
Okay. Well, then just have your app fetch all the data from the API on startup
if you want to store this clientside to reduce the amount of data transmitted, you could tag the data with a "lastUpdatedAt:" field and save that too
then you can fetch just that update field with another api endpoint and compare it to your local save
(this assumes a large and expensive to calculate amount of data, if its small, just fetch it every time)
The main issue was just creating those rows, when the data gets requested is that simple to do?
yes
you need some kind of event to let you know when to fetch the data
window load, button click, etc
then just query the data with
HttpClient.GetFromJson<YourType>
and create a row for each resultWas this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.