1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VS Code の Rest Client で HTTP リクエストがやりやすい

Posted at

便利プラグイン: Rest Client

VC Code プラグイン - Rest Client に関しては、こちら で確認できます。

どう便利かは、下のコードで確認できますが、こちらの記事でもまとめられています。

このプラグインを知ってから、だいぶ確認作業がはかどるようになりました。

コード

JSON CRUD といえば、下記のことを確認する必要があります。

Endpoint Method Description
/product GET 一覧を取得する
/product POST データを追加
/product/<:int> GET 該当するデータを 取得
/product/<:int> PUT 該当するデータを 更新
/product/<:int> DELETE 該当するデータを 削除

以下で、このテーブルの HTTP リクエストを確認できます。

@hostname = localhost
@port = 5000
@host = {{hostname}}:{{port}}
@path = product


GET http://{{host}}/{{path}}/

###

POST http://{{host}}/{{path}}/
Content-Type: application/json

{
    "name": "2",
    "description": "123",
    "price": 123.2,
    "qty": 11
}

###

GET http://{{host}}/{{path}}/1

###

PUT http://{{host}}/{{path}}/1
Content-Type: application/json

{
    "name": "12345",
    "price": 110
}

### 

DELETE http://{{host}}/{{path}}/1
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?