Node-Red HTTP Request Node for Beginners

Node-Red HTTP Request Node for Beginners

http-requestThe node-red http request node is a core node and can be used for making http requests. It can be used for.

  • Retrieving web pages from a website
  • Making API Request
  • Sending and receiving JSON data to a website or API.
  • etc

HTTP Request Node Settings

Below is a screen shot of the http request node configuration page.

The settings include

  1. The request method -The node supports the GET,POST,PUT and DELETE methods.

The main method is GET which is used for getting a web page.

2. The url of the resource –

URL examples:

  • www.google.com
  • www.mysite.com:8080 #set port
  • https://www.google.com :use ssl

3. Authentication -If the website requires authentication then basic authentication can be done here.

4. SSL– A check box for forcing the connection to use SSL

5. Response – The response from the server can be an

  • UTF-8 String i.e. A standard web page
  • binary buffer -Binary data
  • parsed JSON object – Usually used with web APIs. The node will convert JSON data into a JavaScript object.

Programmatically Changing Settings

The request method and the url can also be set in the node or a proceeding node.

htpp-request-node-settings2

To do that you must configure the http request node request method to be set by msg.method and leave the url blank as shown above

You can then use a function or change node to set the method and url by using the msg.method and msg.url properties as shown below.

set-url-method-request-node

Usage Examples

To help you better use this node I’ve created several videos.

-Using The HTTP Request Node -Video 1

In this video tutorial we start with a quick overview of the http protocol and basic request and responses .We start with a basic overview of the node and then use it to get web pages and to process and extract data from web pages.

发布了30 篇原创文章 · 获赞 11 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/armcsdn/article/details/104228858