官术网_书友最值得收藏!

Issuing requests via Postman

The biggest and most obvious advantage of Postman is that it allows you to turn requests into code snippets that you can use and reuse within your code. Thus, Postman can be used to export requests as JavaScript, and that makes it the perfect fit when working with REST API for WordPress or web development.

Postman lets you send authenticated requests in a native manner. In Google Chrome, once you have installed and activated the Postman extension, you can start sending HTTP requests.

Postman supports multiple HTTP requests, and you can see that directly in the drop-down menu.

Of course, for our purpose, the GET and POST requests are the most important.

To issue an HTTP request via Postman, you need to enter the URL value and specify the parameters, if any. For instance, a GET request to a sample URL would look like as shown in the following screenshot:

The preceding requests give us raw response in HTML code. You can also see the same response in JSON, XML, or text format. However, did our GET request actually fetch our WordPress site? Simply hit the Preview link in the pane and you will see your remote WordPress site in the panel.

This is a pretty basic HTTP request and you are just fetching the WordPress site as it is. Since we will be using REST API for bigger and better queries, why not try such a request using Postman?

Say, we wish to login to our remote WordPress site. You can access the wp-admin of your site in a similar manner.

For all practical purposes, using Postman to authenticate you via HTTP requests is possible and feasible. However, since our focus is on the usage of REST API in WordPress, let us now get started with some actual code!

主站蜘蛛池模板: 集贤县| 丰县| 阿拉善右旗| 靖江市| 津南区| 万盛区| 陵川县| 三亚市| 延安市| 永康市| 靖远县| 裕民县| 图们市| 措美县| 乐平市| 赣榆县| 卓尼县| 桓台县| 宁海县| 正蓝旗| 玛曲县| 邛崃市| 胶州市| 平武县| 蒲城县| 陆河县| 上思县| 通江县| 山东省| 金阳县| 曲阜市| 河东区| 年辖:市辖区| 石狮市| 延边| 水富县| 东莞市| 榆社县| 海兴县| 钦州市| 霍林郭勒市|