ユーザ用ツール

サイト用ツール


vscode_restclient

REST Client

  • APIを簡単にコールできる

情報

Unique Identifier humao.rest-client

設定

レスポンス

  • setting.jsonに下記を記述する
"rest-client.decodeEscapedUnicodeCharacters": true

コメント、区切り

  • #が1つでコメントになる
  • #が3つでリクエストを区切れる

変数

  • こんな感じ
@hostname = api.example.com
@port = 8080
@host = {{hostname}}:{{port}}
@contentType = application/json
@createdAt = {{$datetime iso8601}}
@modifiedBy = {{$processEnv USERNAME}}

###

@name = hello

GET https://{{host}}/authors/{{name}} HTTP/1.1

###

PATCH https://{{host}}/authors/{{name}} HTTP/1.1
Content-Type: {{contentType}}

{
    "content": "foo bar",
    "created_at": "{{createdAt}}",
    "modified_by": "{{modifiedBy}}"
}

拡張子

  • http、restにするとVSCode側で認識してくれる

GET

GET http://localhost:50000/api/get/xxx
Content-Type: application/json

参考

vscode_restclient.txt · 最終更新: 2021/06/15 22:55 by 127.0.0.1