Home > Back-end > Spring framework of cloud services provide a restful API, at the same time provide interfaces to oth
Spring framework of cloud services provide a restful API, at the same time provide interfaces to oth
Time:09-25
Recently has been studying the spring cloud services framework, transfer data between micro service using a restful, the question is: if an interface of the micro service foreign provide restful API (mobile), the same API for other services to provide data, so how json format design can achieve the reuse? For example, to the mobile terminal design json is generally as follows: {" the resultCode ": 0," data ": {" username" : "ABC", "id" : 1}, "MSG" : ""}; And for other micro service format for: {" username ":" ABC ", "id" : 1}
CodePudding user response:
1, @ can release the service method also the Rest interface 2, return the data Controller interface can be returned by the HTTP status status data, so can move to other service with the interface data format is the same: {" username ":" ABC ", "id" : 1} Don't need "the resultCode" : 0