In order to build a new feature for my asp.net application, I need to access the rest api of a paid service. This service allows me to open 10 Sessions and for each Session I’m only allowed to make one simultaneously http request.
To create or use a session I can use the HTTP header “x-session-name”.
Each time I make a request with the same value that request uses same session.
To close a session I need to call an logout endpoint with the “x-session-name” header of the session I want to close.
The use case looks like this:
- a user access the new feature via a web app
- the backend makes some calls to the paid rest api with the same session
- the backend closes the session
- the backend sends the user some response
- if a different user access the new feature at the same time, the backend calls the paid api with a different session name
Normally I’m using typed Clients for rest apis and preconfigure the BaseUrl and all Headers of the client in the Startup.
I’m not sure how to make this possible in this scenario.
Do you have some suggestions?