i relatively new building apis , have come across following 2 terms few times , bit confused. i'm hoping can put me straight definitions cannot find on wikipedia. im not sure if can reliably used interchangeably without upsetting people or whether depends on talk to.
sideloading
the ability optionally include other related resource(s) in response
eg./accounts?include=transactions
includetransactions
resources in/accounts
resources response ?this means avoid duplication of resources in response moving them out own section of message, eg.instead of
{ "orders": [ { "id": "101", "product": { "id": "2000", "desc": "blah", "price": "100.0" } "id": "102", "product": { "id": "2000", "desc": "blah", "price": "100.0" }
we have:
{ "orders": [ { "id": "101", "product": { "id": "2000" } "id": "102", "product": { "id": "2000" } ], "products": [ { "id": "2000", "desc": "blah", "price": "100.0" }
composite document
- simply means have mix of related resources (that can stand alone) in resources response eg.
accounts
,transactions
resources can requested on own or combined in same composite document ??
i've never come across consider formal definition of either sideloading or composite, reckon can define how want, provided consistent how resources modelled.
i cant imagine people getting upset terminology. basic premise sound, else semantics , implementation :). said, it's idea keep api object model relatively pure , functional client.
so if used in nested product fashion, , thats api naturally looks like, duplication of
{ "orders": [ { "id": "101", "product": { "id": "2000", "desc": "blah", "price": "100.0" } "id": "102", "product": { "id": "2000", "desc": "blah", "price": "100.0" }
might less of problem added indirection of
{ "orders": [ { "id": "101", "product": { "id": "2000" } "id": "102", "product": { "id": "2000" } ], "products": [ { "id": "2000", "desc": "blah", "price": "100.0" }