Open4

Postman

haseyuyhaseyuy

Sending your first request

A request includes the URL of the API endpoint as well as an HTTP request method. The method indicates the type of action you are asking the API to perform. Here are some of the most common methods:

  • GET retrieves data from an API.
  • POST sends new data to an API.
  • PATCH and PUT update existing data.
  • DELETE removes existing data.

For example, if you're working with an API for a To Do list application, you might use a GET method to retrieve the current list of tasks, a POST method to create a new task, and a PUT or PATCH method to edit an existing task.

haseyuyhaseyuy

Sending parameters

To send a query parameter, add it directly to the URL or open Params and enter the name and value. You can enter your query parameters in either the URL or UI fields and it will update elsewhere.

haseyuyhaseyuy

パスパラメータ(pathparameter)

  • 特定のリソースを識別するために必要な情報
  • URIでドメインの後、?の前に来る
  • groupId=1 は特定のリソースを識別するために必要な情報なる
http://example.com/groups/1

クエリパラメータ(queryparameter)

  • 特定のリソースを操作して取得する際に必要な情報
  • URIで?の後に来る
  • 検索、フィルタなどに関する条件がクエリパラメータとして扱われることが多い
http://example.com/groups/1?sort=false&limit=3

リクエストボディ(requestBody)

  • URIではなく、JSONで送るもの
  • 追加、更新する際の内容を入れる
リクエストするJSON
  group_name: "hogehogehoge",
  group_description: "hogehogehogeのグループです"
haseyuyhaseyuy

Content-Type

Content-Type表現ヘッダーは、リソースのメディア種別を示すために使用される
リクエストにおいては(POSTまたはPUTなどで)、クライアントがサーバーに実際に送ったデータの種類を伝える

構文例:
Content-Type: application/json;charset=utf8
Content-Type: application/x-www-form-urlencoded

Form data

Website forms often send data to APIs as multipart/form-data. You can replicate this in Postman using the form-data Body tab.
Form data allows you to send key-value pairs, and specify the content type.

Raw data

You can use raw body data to send anything you can enter as text. Use the raw tab, and the type dropdown list to indicate >the format of your data (Text, JavaScript, JSON, HTML, or XML) and Postman will enable syntax-highlighting as well as >appending the relevant headers to your request.