Hacker News new | ask | show | jobs
by decklin 5462 days ago
I don't understand the point of "uri":"/transactions/1". Isn't the new resource's URI already part of the response (in the Location: header)? It's sort of like saying GET /posts/show/1 vs. GET /posts/1.
1 comments

I agree, it's redundant.
It's redundant in that particular instance. But it's a representation of a resource. It might be nice to define the representation across your entire system so that when you grab a transaction resource with a GET later, it still has that URI in it. Or maybe not. But it's not obvious that this is a bad idea.
But to access that JSON document with the URI, you had to know the URI already (in this case, by following the Location header).

It's like having a link on a webpage to itself, what's the point? I can just refresh.