News for hackers. Stuff that matters.
Re:Use links not keys to represent relationships in APIs by rich-tea on Sunday May 12, 2019 @02:27AM (#19890501)
You gained the ability to find the invoice. There is no need to have customer id in the invoice url. Just /invoice/invoice_id is enough.
Re:Use links not keys to represent relationships in APIs by viraptor on Sunday May 12, 2019 @03:06AM (#19890595)
I meant a whole tree of methods. Sure, you can get specific invoices from `/invoice/id`, but you probably still want `/customer/id/invoices` or similar for searching through them. You could use extra parameters for `/invoice/...`, but I think often it's nicer to namespace that. (use case dependent)
Re:Use links not keys to represent relationships in APIs by cs02rm0 on Sunday May 12, 2019 @03:52AM (#19890721)
If an invoice id is unique across all customers. Which it probably should be, but other ids might reasonably not be.