Reputation: 3874
My application has "documents", which are essentially just images, and those documents have "regions". The regions simply define the x and y coordinates on a document in order to draw a rectangle and crop the document. A document can have many regions.
Since regions depend wholly on documents, as in they can't exist without a document to be a part of, would my endpoint to create a region look like this?
POST /documents/{document_id}/regions
or like this?
POST /regions
In the second case, I'd have to pass in the document ID via JSON parameters.
Upvotes: 1
Views: 330
Reputation: 41908
The first option. As a general rule, anytime you're interacting with an existent resource by passing an ID in the payload instead of a direct URI, you're doing RPC, not REST.
Upvotes: 2