0
0
Rest APIprogramming~20 mins

Resource identifiers in URLs in Rest API - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Resource Identifier Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this URL parsing code?

Given the URL https://api.example.com/users/42/orders/7, what is the value of the resource identifier for the order?

Rest API
url = 'https://api.example.com/users/42/orders/7'
parts = url.split('/')
order_id = parts[-1]
print(order_id)
A42
Borders
Cusers
D7
Attempts:
2 left
💡 Hint

Look at the last part of the URL after splitting by '/'.

🧠 Conceptual
intermediate
1:30remaining
Which URL correctly identifies a single user resource?

Which of the following URLs correctly identifies a single user resource in a REST API?

Ahttps://api.example.com/users?id=123
Bhttps://api.example.com/users/123
Chttps://api.example.com/users/all
Dhttps://api.example.com/users/123/orders
Attempts:
2 left
💡 Hint

Single resource URLs usually have the resource type followed by its unique ID.

🔧 Debug
advanced
2:00remaining
Why does this URL cause a 404 error?

Given the REST API endpoint /products/{productId}, why does the URL /products/ cause a 404 error?

ABecause the productId is missing in the URL path
BBecause the HTTP method is incorrect
CBecause the server does not support trailing slashes
DBecause the query parameters are malformed
Attempts:
2 left
💡 Hint

Check if the URL includes the required resource identifier.

📝 Syntax
advanced
1:30remaining
Which URL pattern correctly uses resource identifiers for nested resources?

Which URL correctly represents accessing order 55 for user 10?

A/users/10/orders/55
B/orders/55/users/10
C/users/orders/10/55
D/orders/users/10/55
Attempts:
2 left
💡 Hint

Nested resources usually follow the pattern: parent resource, parent ID, child resource, child ID.

🚀 Application
expert
2:00remaining
How many resource identifiers are in this URL?

Count the number of resource identifiers in the URL https://api.example.com/companies/5/departments/3/employees/42.

A1
B2
C3
D4
Attempts:
2 left
💡 Hint

Resource identifiers are the numeric parts that identify specific resources.