iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
📘

HTTP Basics and How to Verify Them for Everyone

に公開

Introduction

Recently, I have been receiving many inquiries from IT operations staff, but since the necessary information is often missing, I have created this article.

HTTP (Hypertext Transfer Protocol) is a protocol for exchanging data on the web. When engineers respond to inquiries from IT operations, the following information is important.

Information Needed

URL

URL (Uniform Resource Locator) is the destination address for a request. For example, it takes a format like https://example.com/api/resource.

Method

HTTP methods specify the type of action a request performs. Common methods include:

  • GET: Retrieving data
  • POST: Creating new data
  • PUT: Updating existing data
  • DELETE: Deleting data

Request Body

The request body is the data sent to the server during POST or PUT methods. It is typically sent in JSON or XML format. Example:

{
  "name": "John Doe",
  "email": "john@example.com"
}

Response Code

Response codes indicate the status of the response from the server. Commonly used codes are as follows:

  • 200 OK: The request was successful
  • 201 Created: A new resource has been created
  • 400 Bad Request: The request is invalid
  • 401 Unauthorized: Authentication is required
  • 404 Not Found: The requested resource could not be found
  • 500 Internal Server Error: An error occurred on the server side

Response Body

The response body is the data returned from the server. This is also usually in JSON or XML format. Example:

{
  "id": 123,
  "name": "John Doe",
  "email": "john@example.com"
}

How to Check

  1. Use browser developer tools
  • Chrome, Firefox, and other browsers have built-in developer tools. You can use these to check HTTP requests and responses from the network tab.
  • To open the developer tools, press the F12 key or right-click and select "Inspect".
  1. Use cURL
  • cURL is a tool for sending HTTP requests from the command line. It is used as follows:
curl -X GET https://example.com/api/resource
curl -X POST https://example.com/api/resource -d '{"name":"John Doe"}' -H "Content-Type: application/json"

  1. Use Postman
  • Postman (https://www.postman.com/) is a GUI-based HTTP client that allows you to easily create complex requests and check responses.

Using this information and these methods, engineers can quickly and accurately check the details of HTTP requests and responses.

Example Report Format

It would be appreciated if you could send an email with the following details:

  • Operation steps
  • URL
  • Method
  • Request Body
  • Response Body
  • Response Code

Summary

If you provide information to engineers while keeping the above points in mind, they will be able to respond smoothly. Providing appropriate information enables quick and accurate problem resolution, so we appreciate your cooperation.

Discussion