How to implement a backend from api with multiple versions

I use Django to implement a private similar API, and I'm not sure how to handle the different versions of the API on the server.

Sense, if I have 2 versions of the API, what does my code look like? Should I have different applications that handle different versions? Should different functions handle different versions? Or should I just use if statements when one version is different from another?

I plan to indicate the version in the header.

thank

+5
source share
1 answer

API REST. REST , " ", .

' ' , . "Must-ignore" , , , . , HTML, HTML- .

"Must-ignore" , , , , .

HTTP , . : Accept , , . ( . http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html).

, , , , Accept .

: API , . - API - ( ) URI (, REST , SOAP!)

+3

All Articles