REST API best naming conventions for resources/endpoints to guarantee maintainability -
usually happens when creating new microservice api lasts couple of months before refactored.
i trying create microservice placed on microservice environment , have questions regarding rest apis better scalability , maintainability:
- resources (resourcex) does not belong specific microservice responsibility/domain exists on environment , crucial (parameter) of endpoint should considered resource , exists on endpoint?
example: have microservice content recommendation , have users on system. recommendation microservice not handles users, uses parameters recommend content. endpoint recommend cars based on specific user should this?
/user/{id}/cars/scoresor should put query param, or this?
- how retrieve specific fields (like lazy loading) given complex resources? resources collections (composed resources, car has array of doors), how should write endpoints it?
example 1: okay have 'partial get' based on parameters? best way accomplish that?
get /resourcex/{id}/cars/{id}?params=doorsqty,color,ownerorget /resourcex/{id}/cars/{id}?mode=compactorget /resourcex/{id}/cars/{id}/justwhatiwant.example 2: endpoint retrieve doors car, should that?
get /resourcex/{id}/cars/{id}/doors
Comments
Post a Comment