天天看点

后台API接口规范

接口规范

最新公司新的项目,使用spring boot,cloud,服务之间使用rest api进行调用,所有使用了restful 风格的接口

@RequestMapping(value = "/getByRegionId/{regionId}", method = RequestMethod.GET)
@ResponseBody
public ObjectRestResponse<List<RegionsDTO>> getByRegionId(@PathVariable("regionId") String regionId) {}

@RequestMapping(value = "/{id}/menu", method = RequestMethod.POST)
@ResponseBody
public ObjectRestResponse modifyMenuAuthority(@PathVariable String id) {}           

restful 风格接口的利弊

其他方式:

http://www.xxx.com/getByRegionId?id=x232323           

规范