这种API的专业术语是什么?

时间:2017-04-14 23:44:55

标签: api http https

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

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

1 个答案:

答案 0 :(得分: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一样设置为arg

domain/cgi_path?arg0=val0&response_type=xml
domain/cgi_path/xml?arg0=val0


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

相关问题