As per the HTTP specification, what response code should PUT send if a new resource is CREATED on the server?
Added by Ryan J.
Step 1
Let's think step by step. Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 58 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
1: Our API should be able to process new User registrations. As a user, I should be able to create a new Account on the endpoint POST localhost:8080/register. The body will contain a representation of a JSON Account, but will not contain an account_id. - The registration will be successful if and only if the username is not blank, the password is at least 4 characters long, and an Account with that username does not already exist. If all these conditions are met, the response body should contain a JSON of the Account, including its account_id. The response status should be 200 OK, which is the default. The new account should be persisted to the database. - If the registration is not successful, the response status should be 400 (Client error). 2: Our API should be able to process User logins. As a user, I should be able to verify my login on the endpoint POST localhost:8080/login. The request body will contain a JSON representation of an Account, not containing an account_id. In the future, this action may generate a Session token to allow the user to securely use the site. We will not worry about this for now. - The login will be successful if and only if the username and password provided in the request body JSON match a real account existing in the database. If successful, the response body should contain a JSON of the account in the response body, including its account_id. The response status should be 200 OK, which is the default. - If the login is not successful, the response status should be 401 (Unauthorized).
Akash M.
HTTP is the protocol that governs communications between web servers and web clients (i.e. browsers). Part of the protocol includes a status code returned by the server to tell the browser the status of its most recent page request. Some of the codes and their meanings are listed below: 200, OK (fulfilled) 403, forbidden 404, not found 500, server error Given an int variable status, write a switch statement that prints out the appropriate label from the above list based on status.
Oswaldo J.
Blogging app creates the following APIs: • /register - POST - takes 3 form parameters ("full name", "email", "password") and registers the user in the database. Use Data Transfer Object (DTO) to send data to the controller. • /login - POST - takes 2 form parameters ("email", "password") and returns the user's JWT ("data" key GenericSuccess(object data)). Use the Hawk class provided in the util package.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD