我们有基于HTTP的restful api。在其他客户端中,我们还有移动设备客户端(例如iphone)。问题是,有几个不同版本的iphone应用程序(1.0、2.0)。因为它们是分布式的,我们无法控制哪个应用程序版本在调用我们。
要在服务器端识别应用程序版本,我看到以下选项:
- device must append URL parameter (e.g. /foo?iphone-app-version=1.0) : A bit yucky, but good thing is that I can see it always on server-logs (URL is always logged)
- we authenticate api-clients with HTTP digest. We could encode the app-version inside the username (e.g. iphone_1_0): Good thing it is logged in server logs, but only works for resources which are exposed as HTTP digest.
- device must use custom HTTP-header, e.g. X-IPHONE-APP-VERSION: In my view the cleanest approach, but we don t log HTTP headers in server logs (for log-noise it is switched off). So later analyzation is not possible.
你有首选的方法或其他选择吗?
编辑:对于上面的版本控制,我不是指api版本控制/内容协商。它是移动设备的版本。