最适合 URL 缩短服务的 API
我刚刚完成了一项用于缩短 URL 的在线服务(在带有 Zend Framework 的 php5 中);您可以输入一个 URL,然后您会得到一个短 URL(例如tinyurl 等网站)。
我正在考虑为开发人员提供 API - 目前您可以使用 SOAP 向服务发送 URL,但我不确定这是否是一个好的解决方案。此类服务的最佳实践是什么?休息?肥皂?两个都?
I've just finished an online service for shortening URLs (in php5 with Zend Framework); you can enter an URL and you get an short URL (like tinyurl and such sites).
I'm thinking about the API for developers - at the moment you can send URLs with SOAP to the service, but I am not sure if this is a good solution. What is the best practice for such a service? REST? SOAP? Both?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我会限制自己休息,因为整个“API”只是两次调用(返回长网址或短网址,反之亦然)。
i'd limit myself to rest, because the whole "API" is just two calls (return the long url for short and vice versa).
绝对是 REST - SOAP 的开销是不必要的,除非您正在构建一个特别安全的企业 URL 缩短服务(我认为这可能是一个矛盾)。 bit.ly API 相当不错,值得一试。
Definitely REST - the overhead for SOAP is unnecessary unless you're building a particularly secure enterprise URL shortening service (which I think is probably an oxymoron). The bit.ly API is pretty good and worth checking out.
在这种情况下,我会说一直采用 REST,SOAP 对此来说太过分了,除了增加网络负载之外什么也得不到。该 API 足够简单,文本描述就足够了,尽管您可能想查看 WADL
In this situation I'd say REST all the way, SOAP is overkill for this and gets you nothing other than an increase in network load. The api is simple enough for a textual description to suffice although you might want to look at WADL
还投票支持 REST,因为 SOAP 对于这个小型 API 来说是一个巨大的野兽和过大的杀伤力。另外,所有流行的 url 缩短服务都使用 REST。您甚至应该考虑紧邻更受欢迎的服务之一,因为这可能有助于开发人员更轻松地添加您的服务;)
Also voting for REST as SOAP is such a big beast and overkill for this small API. Plus all popular url shortening services use REST. You even should consider being quite next to one of the more popular services as this might help developers to more easily add you service ;)