Complete the code to add a self link to the resource.
self_link = request.url + [1]The self link is usually a path like /self appended to the current URL.
Complete the code to return the self link in the JSON response.
return jsonify({"self": [1])
request.base_url which excludes query parameters.request.host_url which is only the domain.The request.url contains the full URL of the current resource, which is used as the self link.
Fix the error in the code to correctly generate the self link.
self_link = f"[1]/self"
request.url which may cause duplicated query parameters.request.path which is only the path, missing domain.The request.base_url gives the URL without query parameters, suitable for appending paths like '/self'.
Fill both blanks to create a dictionary with the self link and resource ID.
response = {"self": [1], "id": [2]request.path with the full URL.The self link uses request.url and the resource ID is stored in resource_id.
Fill all three blanks to build a JSON response with self link, resource ID, and type.
response = {"self": [1], "id": [2], "type": [3]request.path instead of full URL for self link.The self link is request.url, the ID is resource_id, and the type is a string like "example".