What's a good way to design a RESTful URL pattern to get one and many results by ID ?
Ricorda che a REST non interessa quale ortografia usi per i tuoi identificatori.
Qualcosa come
# Single item
/67a6e008-7d99-41ae-b680-3a2c8b3375ad
# Multiple items
/b484b03e-7726-434d-bb25-1a5da0a7315a
è fine .
What (JSON) should be returned if id is omitted
Dovresti restituire la rappresentazione della risorsa identificata.
/invoices e /invoices?id=a/b sono risorse diverse ; per esempio, vengono messi in cache separatamente.
What will a client with a List of IDs of size one get back, an array or a single item
Il cliente recupera la rappresentazione della risorsa richiesta. Non c'è nulla nell'ortografia dell'identificatore che specifica quale sarà la rappresentazione; questo è ciò che Content-Type è per. Nel caso di application / json , sarà un JSON-text di un certo sapore, ma ciò non distingue tra object e array .