api design - API for mobile apps, should it have colors in it? -
recently in our team had give-and-take whether have colors in api responses. example
{ "message": "hello", "color": "red" }
versus
{ "message": "hello", "type": "danger" }
for first alternative pros are
if need alter color of element, don't have re-compile , submit 1 time again app appstorecons are
you cannot force colors api, of them still hardcoded. if alter 1 color, have alter other similar colors, otherwise @ risk of having christmas-tree app, bunch of different reddish colors.for sec alternative pros are
you have purely info based api, decide how ui should looks likecons are
if need alter color, need re-compile app , publish 1 time again appstore, may take whiledear friends, think 2 different approaches? please give arguments either prove sentiment or dodge it. how other big companies design apis? never seen api providing colors, haven't seen lot of apis.
thank much
an api designed provide way access pure data, without ui content, therefore, sec alternative more "correct", becouse specify type , not how should look. option, consume api , decide how every message type should look.
api-design
No comments:
Post a Comment