restful api相关

什么是restful api:可以网上百度,这里我只讲一下我所掌握和理解的。

restful api一般有get、put、post、delete等。

get:一般用来获取信息。

put:一般用来更新信息。

post:一般用来新增信息。

delete:一般用来删除信息。

其实每个api用来执行些什么,是可以自己去定义的,比如get,不是一定要用来获取信息,也可以自己去修改,让它实现增、改、删。

restful api具体长啥样呢,这里举些例子:

get:www.xxxxxx.com/source/{id}     后面可以跟一个id,从表中获取指定id的信息。

post:www.xxxxxx.com/source/{id}    如果是post请求,那么就是增加id是{id}的字段。

猜你喜欢

转载自blog.csdn.net/nwtiz/article/details/82626890