是否有REST API的任何命名约定指引? [英] Are there any naming convention guidelines for REST APIs?

查看:234
本文介绍了是否有REST API的任何命名约定指引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在创建REST API的,是那里的API中的命名规则的任何指引或事实上的标准(例如:URL端点路径组件,查询字符串参数)?是骆驼帽常态,或下划线?其他人呢?

When creating REST APIs, are there any guidelines or defacto standards for naming conventions within the API (eg: URL endpoint path components, querystring parameters)? Are camel caps the norm, or underscores? others?

例如:

api.service.com/helloWorld/userId/x

api.service.com/hello_world/user_id/x

请注意:这不是基于REST的API设计的问题,而命名约定准则,以用于使用的最终路径组件和/或查询字符串参数

Note: This is not a question of RESTful API design, rather the naming convention guidelines to use for the eventual path components and/or query string parameters used.

任何指导方针将是AP preciated。

Any guidelines would be appreciated.

推荐答案

我觉得你应该避免驼帽,因为URL不区分大小写。该规范是使用小写字母。我还要避免下划线和使用破折号,而不是

I think you should avoid camel caps, as urls are not case sensitive. The norm is to use lower case letters. I would also avoid underscores and use dashes instead

所以您的网址应该是这样的(忽略了设计问题,你要求的: - ))

So your URL should look like this (ignoring the design issues as you requested :-))

api.service.com/hello-world/user-id/x

这篇关于是否有REST API的任何命名约定指引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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