Given the URL https://api.example.com/users/42/orders/7, what is the value of the resource identifier for the order?
url = 'https://api.example.com/users/42/orders/7' parts = url.split('/') order_id = parts[-1] print(order_id)
Look at the last part of the URL after splitting by '/'.
The URL is split by '/', so the last part is the order ID '7'.
Which of the following URLs correctly identifies a single user resource in a REST API?
Single resource URLs usually have the resource type followed by its unique ID.
URL 'https://api.example.com/users/123' points directly to user with ID 123.
Given the REST API endpoint /products/{productId}, why does the URL /products/ cause a 404 error?
Check if the URL includes the required resource identifier.
The endpoint requires a productId after /products/. Without it, the server cannot find the resource.
Which URL correctly represents accessing order 55 for user 10?
Nested resources usually follow the pattern: parent resource, parent ID, child resource, child ID.
The correct pattern is /users/10/orders/55 where 10 is user ID and 55 is order ID.
Count the number of resource identifiers in the URL https://api.example.com/companies/5/departments/3/employees/42.
Resource identifiers are the numeric parts that identify specific resources.
The URL has three resource identifiers: 5 (company), 3 (department), and 42 (employee).