Middle
Tell me about the principle of resource identification.
sobes.tech AI
Answer from AI
The Resource Identification Principle states that each resource in a system must have a unique identifier that allows it to be unambiguously discovered and accessed.
Main goals and objectives of the principle:
- Uniqueness: Each resource has its own unique identifier.
- Discoverability: The resource can be found by its identifier.
- Portability: The resource's identifier should not depend on its physical location or storage method.
- Independence from representation: The identifier should remain stable even if the resource's representation changes (e.g., data format).
Examples of identifiers:
- URL (Uniform Resource Locator): The most common example. Indicates both the resource and how to access it.
// Simple URL example https://example.com/users/123 - URN (Uniform Resource Name): Identifies a resource by name without indicating access method.
// URN example for ISBN book urn:isbn:0-486-27557-4 - UUID (Universally Unique Identifier): Globally unique identifier.
// UUID example a1b2c3d4-e5f6-7890-1234-abcdef123456 - ID in databases: Unique key for a record in a table.
-- SQL query using ID SELECT * FROM products WHERE product_id = 456;
Value for QA:
- API testing: Verify the correctness of resource identification in requests.
- Integration testing: Ensure systems correctly use identifiers during data exchange.
- Performance testing: Assess the efficiency of resource search by identifiers.
- Security testing: Check access to resources by identifier (authorization, authentication).
- Data testing: Verify the uniqueness and integrity of identifiers in data stores.