简单 web 服务与客户端开发实战 复制SWAPI网站 api文档

项目github地址如下
https://github.com/BigBrother3

本篇文档主要是展示一下项目中的api

查找资源api

直接用get请求 http://localhost:8080/api/films/1 ,就可以得到资源。
在这里插入图片描述
资源的api主要有

总的api,默认返回第一页的内容,每页有5个资源

http://localhost:8080/api/films
http://localhost:8080/api/people
http://localhost:8080/api/planets
http://localhost:8080/api/species
http://localhost:8080/api/starships
http://localhost:8080/api/vehicles

按页搜索的api,每页有5个资源

http://localhost:8080/api/films/?pages=%d
http://localhost:8080/api/people/?pages=%d
http://localhost:8080/api/planets/?pages=%d
http://localhost:8080/api/species/?pages=%d
http://localhost:8080/api/starships/?pages=%d
http://localhost:8080/api/vehicles/?pages=%d

按个搜索的api

http://localhost:8080/api/films/%d
http://localhost:8080/api/people/%d
http://localhost:8080/api/planets/%d
http://localhost:8080/api/species/%d
http://localhost:8080/api/starships/%d
http://localhost:8080/api/vehicles/%d

注册用户api

向http://localhost:8080/register 发送post请求,并将用户名和密码的信息发出,就可以看到服务端返回成功的字样。
在这里插入图片描述

登陆用户api

向http://localhost:8080/login 发送post请求,并将之前注册的用户名和密码发出,可以看到服务器传回来一个token,通过这个toke就可以验证用户是否登陆了。
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值