Stuck on API design principles (and lack there of) and hoped I could get a few wise opinions...
We are converting an old monolith to modern micro services and getting stuck on the design conventions that may bite us down the road. My current conundrum:
Hypothetically... we have large widgets and small widgets. Large widgets are extra complex and store lots of data across a bunch of tables. Small widgets are straight forward and stored in one table. We want to make a public API with a new fancy JS site that mostly presents these widgets separately but in some less common occurrences we will present them all together.
So, trying to decide which is the best design to present these to be able to separate or show all as needed. (and do not want to do just one widget resource where type="small" due to the discrepancy between # of fields, effort to get data, etc.)
In one API endpoint?
e.g.
/api/widgets
or is it advantageous to break into 3 endpoints?
/api/largeWidgets
/api/smallWidgets
Or does it even matter?
-----
One API GET resource example:
response:
{ "largeWidgets":[
{
"value 1": "Awesome widget",
...
"value 25": "123456"
},
"value 1": "Big ol' widget",
], "smallWidget":[
"value 1": "tiny widget",
]
}
Multiple endpoint GET response example
largeWidgets response example:
"value1": "Awesome widget",
"value1": "Big ol' widget",
smallWidgets response example:
"value 1": "tiny widget",
Widgets response example:
"value1": "Large widget",
"value1": "Small widget",
Huge thanks for any insight, advice, experiences