【发布时间】:2017-04-15 09:32:32
【问题描述】:
您在其末尾添加参数的 URL,它会返回给定特定参数的结果,例如:
api.website.com/something.json?foo=2&bar=1
【问题讨论】:
-
/something是一个接受查询字符串参数的端点。不确定我是否见过带有.json的端点URL...
您在其末尾添加参数的 URL,它会返回给定特定参数的结果,例如:
api.website.com/something.json?foo=2&bar=1
【问题讨论】:
/something 是一个接受查询字符串参数的端点。不确定我是否见过带有.json 的端点URL...
常见的方式看起来像你提到的方式
domain/cgi_path?param_0=val_0&...¶m_n=val_n
但它也可以在任何其他方案中
domain/cgi_path/sub_path_as_param <<-- note the subpath as param instead of param
domain/images/2 <<-- instead of domain/images?page=2
或
domain?pg=cgi_path?args=blah_blah <<-- note the path as arg for one global path
关于.json 部分,它不是很常见,但它是一个人性化的东西,可以告知开发人员可能的响应类型(如果它是一个巨魔)
但类型也可以设置为 arg
domain/cgi_path?arg0=val0&response_type=xml
domain/cgi_path/xml?arg0=val0
最后以任何你喜欢的方式去,对你来说看起来很容易。但请记住为它制作一个很棒的文档。
【讨论】: