【问题标题】:What's the professional term for this type of API?这种API的专业术语是什么?
【发布时间】:2017-04-15 09:32:32
【问题描述】:

您在其末尾添加参数的 URL,它会返回给定特定参数的结果,例如:

api.website.com/something.json?foo=2&bar=1

【问题讨论】:

  • /something 是一个接受查询字符串参数的端点。不确定我是否见过带有.json 的端点URL...

标签: api http https


【解决方案1】:

常见的方式看起来像你提到的方式

domain/cgi_path?param_0=val_0&...&param_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


最后以任何你喜欢的方式去,对你来说看起来很容易。但请记住为它制作一个很棒的文档。

【讨论】:

    猜你喜欢
    • 2012-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-28
    • 2018-10-23
    • 1970-01-01
    • 2012-04-13
    • 1970-01-01
    相关资源
    最近更新 更多