日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

http接口测试工具——RESTClient

發(fā)布時間:2025/3/20 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 http接口测试工具——RESTClient 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

2019獨角獸企業(yè)重金招聘Python工程師標準>>>

WizTools.org RESTClient?is a Java Swing application for testing RESTful web services. It might be used for testing other HTTP communications too. This is a short introduction of this tool explaining its various features.

The First Step

RESTClient can be downloaded from?http://code.google.com/p/rest-client/downloads/list. It is a single Jar file. To run it, you need to have Java 5 installed. After downloading, Windows users need to double-click to start the application. Non-Windows users, fire up your command prompt/shell, and issue:

$ java -jar restclient-2.1-jar-with-dependencies.jar

The UI

Once it is started, you will see this UI:

As seen in the screenshot, the UI is divided into two sections. The top portion has the HTTP request details and the bottom portion has the HTTP response details. To get started, just enter the value “http://wiztools.org/” in the URL field. Now press the green “>>” button near to the URL field. You should find the response details in the Response section of the UI.

RESTful Web services Example

Now we will use RESTClient to learn how it can be used to test a RESTful web services. We will take the example of social bookmarking site?BibSonomy.org?for example. If you do not have an account with this site, please sign up for a free account. The REST API of this service is documented in this page:?http://www.bibsonomy.org/help/doc/api.html. For using this service, you have to request API key here:?http://www.bibsonomy.org/help/doc/gettingaccess.html.

Once you get the API key, you are ready to start! Fire up RESTClient. We will do the following operations on BibSonomy.org:

  • List all the posts you made

  • Create a post (bookmark entry)

  • Change post

  • Delete post

  • Before we start trying out the features of BibSonomy.org, you have to understand the authentication mechanism of this site. In the authentication tab, make sure you give:

    • BASIC authentication method should be selected.

    • Preemptive can be selected (not mandatory). Having this selected will send the authentication details to the server even before the server challenges for it.

    • Give your BibSonomy username and API key as the password.

    Now we jump on to the operations. All the operations will require that this authentication detail to be configured.

    Operation 1: List all the posts you made

    To list all the posts you have made, enter this URL in the URL box:

    http://www.bibsonomy.org/api/posts?user=subwiz&resourcetype=bookmark

    (Note: Replace all mentions of `subwiz' with your BibSonomy.org userid. `subwiz' is the author's BibSonomy.org userid.)

    Make sure you have entered the authentication details as mentioned. Now with the method entered as GET, hit the green “>>” button.


    As you see in the body tab of the Response section, it has returned an XML saying that this user does not have any posts yet. We will be using?Operation 1?further down in the tutorial to see the status of our additions, updations and deletions.

    Operation 2: Create a post

    To create a post, you have to hit this URL:

    http://www.bibsonomy.org/api/users/subwiz/posts

    The HTTP method to be used is POST for create operation. Make sure you select this option in the Method tab.


    After selecting the POST method, the Body tab controls get enabled. Body is supported only for POST and PUT methods. In the Body tab, add the bookmark post detail in the following format:

    <?xml?version="1.0"?> <bibsonomy><post?description="WizTools.org?OpenSource"><user?name="subwiz"/><tag?name="opensource"/><tag?name="java"/><group?name="public"/><bookmark?url="http://wiztools.org/"?title="WizTools.org"/></post> </bibsonomy>

    Make sure you change the content-type to?application/xml?and charset to?UTF-8?(click the Edit button near to the content-type/charset text field to change). Finally, it should look like:

    Now execute the request by pressing the “>>” button. The response screen should be something similar to:


    and:


    Response status 201 means success. Make note of the hash returned (which in our case is: 03fb1f5d1634e4bd72e6ccdc0cdafcc2) in the body of the response. This will be needed for the next operation. Now perform?Operation 1?to see your new post getting displayed.

    Operation 3: Change post

    The URL for updating a existing post is:

    http://www.bibsonomy.org/api/users/subwiz/posts/03fb1f5d1634e4bd72e6ccdc0cdafcc2

    For updating a post with new/changed data, HTTP PUT method is used. Select PUT from the Methods tab, and enter in the body text:

    <?xml?version="1.0"?> <bibsonomy><post?description="WizTools.org?OpenSource"><user?name="subwiz"/><tag?name="opensource"/><tag?name="java"/><tag?name="REST"/><bookmark?url="http://wiztools.org/"?title="WizTools.org--OpenSource?Software"?intrahash="03fb1f5d1634e4bd72e6ccdc0cdafcc2"interhash="03fb1f5d1634e4bd72e6ccdc0cdafcc2"/></post> </bibsonomy>

    As you see, we have added a new tag REST and updated the title. Also remember to set the Content-type and charset to?application/xml?and?UTF-8?respectively. Execute the request, and performOperation 1?to validate.

    Operation 4: Delete post

    The final operation is the DELETE operation. The URL for this is:

    http://www.bibsonomy.org/api/users/subwiz/posts/03fb1f5d1634e4bd72e6ccdc0cdafcc2

    From the Methods tab, select DELETE. If the DELETE operation is successful, the Response status code will be 200 OK. Perform?Operation 1?to validate.

    Testing Using RESTClient

    Another interesting feature in RESTClient is the ability to attach test scripts written in Groovy with each request. More on this is covered in the?tutorial at the site.

    Persisting Request et all

    RESTClient also supports persisting request, response and request-response combination. This helps in record and playback support. These options are available in the?File?menu.

    What Else?

    RESTClient has been developed with active input from the?REST-Discuss?community. If you have any request (both bugs and features), just?file a issue.

    Topics:

    ?


    轉載于:https://my.oschina.net/hellotest/blog/609422

    總結

    以上是生活随笔為你收集整理的http接口测试工具——RESTClient的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

    主站蜘蛛池模板: 免费人成视频在线播放 | 久久久婷| 国产精品视频一区二区三区不卡 | 久久久久久国产精品日本 | 日本三级一区二区三区 | 国产成年视频 | 蜜臀久久精品 | www国产黄色 | 三级在线观看网站 | 黄色三级在线播放 | 热热热热色 | 久久这里只有精品99 | 欧美人与禽性xxxxx杂性 | 亚洲AV成人无码久久精品同性 | 久久人人爽人人爽人人 | 久久66热这里只有精品 | 日韩毛片一区 | 免费无码不卡视频在线观看 | 中文字幕成人在线观看 | 91精品视频网| 啪啪啪一区二区 | 精品自拍第一页 | 日b视频免费观看 | 美女毛片视频 | 国产精品一区二区三区免费观看 | 殴美一级视频 | 久久久久久久久久艹 | 欧美黄色aaa| 亚洲av久久久噜噜噜熟女软件 | 男生捅女生肌肌 | mm131丰满少妇人体欣赏图 | mdyd—856冲田杏梨在线 | 日韩永久免费视频 | 青青草一区二区三区 | 99精品国产成人一区二区 | 射射av| 在线观看日韩一区 | 日日夜夜精品视频免费 | 中文字幕日韩在线观看 | 97视频免费 | 国产精品久久久久久福利 | 无码人妻精品一区二区蜜桃色欲 | 久久国产主播 | 国产日韩欧美中文字幕 | 中国美女性猛交 | 无码精品人妻一区二区三区湄公河 | 国产夫妻性生活 | 亚洲女人在线 | 日韩中文字幕亚洲精品欧美 | av草逼 | 午夜福利电影一区二区 | 中文字幕一区av | 99精品在线观看视频 | 一级片亚洲 | 国产一区二区三区成人 | 日韩三区在线 | 免费91视频| av手机在线免费观看 | 依人在线视频 | 日日日日干 | 在线观看亚洲成人 | 激情五月亚洲 | 精品一区二区三区无码视频 | 色播开心网 | 亚洲黄色在线免费观看 | 人人射av| 亚洲精品中文字幕在线 | 日韩欧美精品一区二区 | 日本一区二区在线看 | mm131美女大尺度私密照尤果 | 毛片在线观看网站 | www.4虎| 国产精品乱码一区二三区小蝌蚪 | 午夜国产 | 成人影院免费 | 国产黄色在线看 | 欧美一区二区性久久久 | 亚洲国产精品18久久久久久 | 国产激情小视频 | 日韩视频一二三区 | 日本艳妇| 国产88av| 美丽的姑娘观看在线播放 | 网红av在线 | 亚洲欧美日韩久久 | 在线观看黄色国产 | 久久欧美视频 | 亚洲国产成人一区二区 | 免费无遮挡无码永久在线观看视频 | 无码人妻丰满熟妇区毛片蜜桃精品 | 久久久免费在线观看 | 91精品观看| 日韩淫视频 | 欧洲久久久| 欧美三级图片 | 91这里只有精品 | 亚洲第一免费播放区 | 欢乐谷在线观看免费播放高清 | 欧美日韩女优 |