1

We want to create general public web services and we create customized APIs. But how to isolate, version and bind those endpoints as a hyperscaled system?

We want to have:

  • https://api.domain.tld/v1/..
  • https://api.domain.tld/v2/..
  • https://api.domain.tld/latest/..
  • https://api.domain.tld/bosch/v1/..

or

  • https://domain.tld/api/v1/..
  • https://domain.tld/api/v2/..

All endpoints should be isolated. Behind an endpoint like https://domain.tld/api/v2/.. exists at least 3 instances of an ASP.NET WebAPI. We do not want to separate versioning by namespaces inside the WebAPI project and use internal route configurations to resolve this.

We want to have this behavior onpremise and aswell on Azure. Is there any recommendation or best practise and configuration samples out there?

I could only found one thread here (How to version and configure WebApi with multiple aliases) which is very old and there is no answer.

1 Answer 1

1

I always use the version as the api route, like you so:

https://domain.tld/api/v1/..
https://domain.tld/api/v2/..

which has always worked fine, but other use url parameters, which I find to be less explicit:

Visual Studio Team Services - API

I would just not recomend you to go with this pattern:

https://api.domain.tld/latest/..
https://api.domain.tld/bosch/v1/..

It would you make you API look a bit messy, but it could make sense if you use logical services in your API:

https://api.domain.tld/service1/v1
https://api.domain.tld/service1/v2
https://api.domain.tld/service2/v1
Sign up to request clarification or add additional context in comments.

12 Comments

Thank you for your response. But the question how to map the subfolders to separate instances is still open. For example https://api.domain.tld/service1/v1 is Instance3 on Server1 and https://api.domain.tld/service1/v2 should be Instance9 on Server17. Is the load balancer responsible for this?
And the logical separation for customized APIs will be https://api.domain.tld/bosch/userservice/v1 https://api.domain.tld/bosch/orderservice/v3 but that leaves me here with the same problem: how to map sub directories to services.
Why do you need a load balance for that? That's just web api mappings we are talking about.
these are heavily used endpoints. We need to load balance them. Nobody here talks about the api mapping itself. My question is still: how to map virtual directories to bindings?! Behind https://api.domain.tld/bosch/orderservice/v1 there can exists 7 instances. But how to map them?! In IIS I can only bind the domain api.domain.tld but not the additional /bosch/orderservice/v1. But we do not want to hold the API versioning inside the API Code and cover that with Routes. That is useless and not scalable!
Well, you can definitelly create multiple virtual directories but that would be a bit messy, having virtual directories to act as the version part of your URL. As for the load balance, I'm sorry but it seems that we're talking different things, the load balance works by dispatching requests to a single port, you don't have to worry about getting too many requests to the same port, and you surelly don't need diferent virtual sites fot that.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.