I want to write a simple desktop application that issues GET requests to a REST API and parse the retrieved JSON into class objects.
This is the GET request I'm mainly gonna be using:
GET /api/timesheets (Returns a collection of timesheet records)
Demo response
[
{
"activity": 174,
"project": 12,
"user": 1,
"tags": [],
"id": 5610,
"begin": "2021-05-28T01:44:00-0700",
"end": null,
"duration": null,
"description": null,
"rate": 0,
"internalRate": 0,
"exported": false,
"billable": true,
"metaFields": []
},
{
"activity": 305,
"project": 23,
"user": 1,
"tags": [
"Et quo.",
"Aut ut."
],
"id": 240,
"begin": "2021-05-25T23:33:00-0700",
"end": "2021-05-26T05:18:00-0700",
"duration": 20700,
"description": "Latitude was, or Longitude either, but thought they were mine before. If I or she should chance to be patted on the.",
"rate": 465.75,
"internalRate": 0,
"exported": false,
"billable": true,
"metaFields": []
}
]
I'm most interested in the user and duration values as I need to parse them into a Timesheet class object and store them inside a database.
So my question is: What's the best-practise way of doing this?
I've tried Process.Start() using the given curl and redirecting the StandardOutput to a string variable. This technically works but would be a pain and I'm sure there's a way better solution to this.
Thanks in advance!