I am modeling the following hierarchy in the REST URL:
Document-Type is a group of related documents.
Document: JSON document with specific details.
example:
IncomeTaxReturnsDocument,ShareMarketDailyStatusDocument,TopProfitCompaniesListDocumentetc
Each Document-Type has a dedicated schema and differs from other documents belonging to different Document-Type.
example:
IncomeTaxReturnsDocumenthas specific schema which differs fromShareMarketDailyStatusDocument.
To model this in REST interface, I followed below approach:
https://{base_url}/v1/document-types/{document_type_id}/document
where document_type_id can be IncomeTaxReturnsDocument, shareMarketDailyStatusDocument etc
The combination of document_type and document in the URL makes the resource unique.
Other option is: to model based on resource type.
https://{base_url}/v1/IncomeTaxReturnsDocument
https://{base_url}/v1/shareMarketDailyStatusDocument
But this approach forces me to create "n" number of URLs ( one for each document_type) and the list grows to 100s.
Is making URL unique by combining the document_type_id in the path variable and document together is a bad practice ?
Does https://{base_url}/v1/document-types/{document_type_id}/document violates any REST guidelines?