rest - Can I combine resources in a RESTful API? -


In my application there is a "document", which is essentially just images, and those documents have "areas" Defines the X and Y coordinates on a document to attract a rectangle and crop the document. There may be several areas in one document.

Since the areas are completely dependent on the documents, because they can not exist in one part of the document, will there be an end point for creating such an area?

  Posts / Documents / {document_id} / regions  

Or like that? In the second case, I have to pass through the JSON parameter in the document ID.

  Posts / regions  

The first option, as a general rule, anytime you pass an ID directly into the payload instead of the URI By talking to the resource available, you are doing RPC, not REST


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -