C#C
C#3y ago
19 replies
big OOF

❔ Retrieve API data in C#

What structure would you use if you want to create an API that retrieves data from another API and returns it to the user.

Im thinking:
1. API controller takes the GET request from user and calls the service class
2. Service class that makes the API call

At the moment im instantiating a httpClient in the service class but ideally i would want the functions in the service class to be static, but then i cant instantiate httpclient.

Is this the right "way/structure" to do it and/or do any tips regarding the static service class ? 🙂

Thanks!
Was this page helpful?