我应该如何构建一个好的(网络)API [英] How should I build a good (web) API

查看:38
本文介绍了我应该如何构建一个好的(网络)API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要为一个网络应用构建一个 API,我对人们可以推荐的良好做法很感兴趣.

I'm going to build an API for a web app and I'm interested in what people can suggest as good practices.

我已经计划将其版本化(版本 1 只能控制系统的某些方面,版本 2 可以控制更多,但这可能需要更改与版本 1 不兼容的身份验证方式),并且身份验证将与人们用于登录的标准用户名/密码不同(如果有人确实使用了恶意工具,它不会将其打开以完全模拟,只要 api 允许).

I'm already planning to make it versioned (version 1 can only control certain aspects of the system, version 2 could control more, but this may need a change in the way authentication is performed that would be incompatible with version 1), and the authentication will be distinct from the standard username/password people use to log in (if someone does use a malicious tool it won't open them up to full impersonation, just whatever the api allows).

有没有人有进一步的想法,或者您使用过的具有特别好的 API 的网站示例?

Does anyone have further ideas, or examples of sites with particularly good APIs you have used?

推荐答案

阅读 RESTfulWeb Services 一书,它为您提供了如何在实践中使用 REST 的良好概述,并且可以快速上手,现在就可以放心地开始使用.这比仅仅查看现有 API 更有用,因为它还讨论了设计选择和权衡.

Read the RESTful Web Services book, which give you a good overview of how to use REST in practice, and get to up to speed quickly enough to get started now, with some confidence. This is more useful than just looking at an existing API, because it also discusses design choices and trade-offs.

这篇关于我应该如何构建一个好的(网络)API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆