Restyは休むコマンドラインクライアントとサービスの相互作用HTTPを使用するにはどのように?|残りのサービスと対話するためrestyコマンドラインクライアントをインストールして使用する方法

この記事では、最初の個人的なブログ登場https://kezunlin.me/post/4f5f98b9/最新の内容に、ようこそ!

残りのサービスと対話するためrestyコマンドラインクライアントをインストールして使用する方法

ガイド

インストール

あなたはカール、権利を持っていますか?はい。

curl -L https://raw.githubusercontent.com/micha/resty/master/resty > resty

それを使用する前に、スクリプトを調達。

. resty

restyをインストールしたら、あなたはあなたの要求を作ることになるためにあなたのRESTホストを設定します。

resty http://127.0.0.1:8080/data
http://127.0.0.1:8080/data*

そして今、あなたは、いくつかのHTTPリクエストを行うことができます。

$ GET /blogs.json
[ {"id" : 1, "title" : "first post", "body" : "This is the first post"}, ... ]

$ PUT /blogs/2.json '{"id" : 2, "title" : "updated post", "body" : "This is the new."}'
{"id" : 2, "title" : "updated post", "body" : "This is the new."}

$ DELETE /blogs/2

$ POST /blogs.json '{"title" : "new post", "body" : "This is the new new."}'
{"id" : 204, "title" : "new post", "body" : "This is the new new."}

使用法

source resty [-W] [remote] [OPTIONS]    # load functions into shell
  resty [-v]                              # prints current request URI base
  resty <remote> [OPTIONS]                # sets the base request URI

  HEAD [path] [OPTIONS]                   # HEAD request
  OPTIONS [path] [OPTIONS]                # OPTIONS request
  GET [path] [OPTIONS]                    # GET request
  DELETE [path] [OPTIONS]                 # DELETE request
  PUT [path] [data] [OPTIONS]             # PUT request
  PATCH [path] [data] [OPTIONS]           # PATCH request
  POST [path] [data] [OPTIONS]            # POST request
  TRACE [path] [OPTIONS]                  # TRACE request

  Options:

  -Q            Don't URL encode the path.
  -q <query>    Send query string with the path. A '?' is prepended to
                <query> and concatenated onto the <path>.
  -W            Don't write to history file (only when sourcing script).
  -V            Edit the input data interactively in 'vi'. (PUT, PATCH,
                and POST requests only, with data piped to stdin.)
  -Z            Raw output. This disables any processing of HTML in the
                response.
  -v            Verbose output. When used with the resty command itself
                this prints the saved curl options along with the current
                URI base. Otherwise this is passed to curl for verbose
                curl output.
  --dry-run     Just output the curl command.
  <curl opt>    Any curl options will be passed down to curl.

その他のツール

郵便配達

ポストマンは、APIの開発のためのコラボレーションプラットフォームです。あなたがより良いAPIを、より速く作成できるように郵便配達の機能は、各APIを構築するステップと流線コラボレーションを簡素化

ダウンロードPostman-linux-x64-7.10.0.tar.gzからここに

tar xzvf Postman-linux-x64-7.10.0.tar.gz
cd Postman
./Postman

今、私たちは無料のアカウントを作成して、郵便配達で遊ぶことができます。

Chromeデベロッパーツール

F12 --->ネットワーク。

httpbin

シンプルなHTTPリクエスト&レスポンスサービス。

参照httpbinを

参照

歴史

  • 20191106:作成しました。

著作権

  • 投稿者:kezunlin
  • ポストリンク:https://kezunlin.me/post/4f5f98b9/
  • 著作権:別途明記しない限り、このブログのすべての記事はCC BY-NC-SA 3.0の下でライセンスされています。

おすすめ

転載: www.cnblogs.com/kezunlin/p/12117884.html