Activity 30: HTTP Status Codes

·

1 min read

Research and understand the various HTTP status codes used in RESTful APIs to indicate the result of an API request. Focus on these main categories:

  • 1xx (Informational): These codes indicate that the request was received and is being processed, but there is no final response yet.

  • 2xx (Success):

    • 200 OK: The request was successful, and the server returned the requested data.

    • 201 Created: The request was successful, and a new resource was created as a result.

    • 204 No Content: The request was successful, but there is no content to send in the response.

  • 3xx (Redirection): These codes indicate that the client must take additional actions to complete the request (e.g., redirecting to another URL).

  • 4xx (Client Error):

    • 400 Bad Request: The request was invalid or cannot be understood by the server.

    • 401 Unauthorized: Authentication is required for the requested resource.

    • 403 Forbidden: The client does not have permission to access the resource.

    • 404 Not Found: The requested resource could not be found.

  • 5xx (Server Error):

    • 500 Internal Server Error: The server encountered an error and could not complete the request.

    • 503 Service Unavailable: The server is temporarily unavailable, often due to maintenance or overload.

Search when and why these status codes are used in RESTful APIs,