What are your WebService Versioning best practices?

前端 未结 4 777
悲哀的现实
悲哀的现实 2021-01-30 18:37

We have 2 separate products that need to communicate with each other via web services. What is the best-practice to support versioining of the API?

I have this article

4条回答
  •  自闭症患者
    2021-01-30 18:57

    I prefer the Salesforce.com method of versioning. Each version of the Web Services gets a distinct URL in the format of:

    http://api.salesforce.com/{version}/{serviceName}
    

    So you'll have Web Service URLs that look like:

    http://api.salesforce.com/14/Lead
    
    http://api.salesforce.com/15/Lead
    

    and so on...

    With this method, you get the benefits of:

    1. You always know which version you're talking to.

    2. Backwards compatibility is maintained.

    3. You don't have to worry about dependency issues. Each version has the complete set of services. You just have to make sure you don't mix versions between calls (but that's up to the consumer of the service, not you as the developer).

提交回复
热议问题