C#C
C#3y ago
stigzler

❔ Optimising multi-threaded web API calls

Hi all. I am looking to code a wrapper to access a web API (Screenscraper.fr). The API provides both metadata for games and also images via download urls.

My question is about how best to approach this. Al I know about he web API is that it provides users with a variable number of "threads." I have no idea how this works from the Web API application side. Sadly, that means I don't know what counts as a "thread" from the application's point of view. The app is great, the documentation and support less so!

I will need to be downloading text (the metadata - in either xml or json) and the images.

Should I use a Parallel ForEach loop, or will this not count as "threads" on the API?

Also, I'm going o finally try and get to grips with HttpClient
  • I understand you should only initiate one HttpClient and keep it 'live'? If so, I would presumably need to spawn a number of HttpClients totalling the users number of threads. How would I weave this in code?
ope make sense. Sorry, I'm not a professional developer, just a hobbyist!
Was this page helpful?