Node-Red HTTP Request Node for Beginners

本文介绍Node-RED中的HTTP请求节点,一种用于发送GET、POST、PUT和DELETE请求的核心节点。它能从网站获取网页,进行API调用,发送和接收JSON数据。文章详细解释了设置请求方法、URL、身份验证、SSL使用及响应类型的方法,并提供了通过编程方式改变设置的技巧。

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.

评论 3
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值