{"id":95443,"date":"2020-04-08T10:20:56","date_gmt":"2020-04-08T10:20:56","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=95443"},"modified":"2022-10-27T15:05:45","modified_gmt":"2022-10-27T15:05:45","slug":"esp32-http-get-post-arduino","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/esp32-http-get-post-arduino\/","title":{"rendered":"ESP32 HTTP GET and HTTP POST with Arduino IDE (JSON, URL Encoded, Text)"},"content":{"rendered":"\n<p>In this guide, you&#8217;ll learn how to make HTTP GET and HTTP POST requests with the ESP32 board with Arduino IDE. We&#8217;ll cover examples on how to get values, post JSON objects, URL encoded requests, and more.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/ESP32-HTTP-GET-HTTP-POST-with-Arduino-IDE-JSON-URL-Encoded-Text.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 HTTP GET and HTTP POST with Arduino IDE (JSON, URL Encoded, Text)\" class=\"wp-image-95502\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/ESP32-HTTP-GET-HTTP-POST-with-Arduino-IDE-JSON-URL-Encoded-Text.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/ESP32-HTTP-GET-HTTP-POST-with-Arduino-IDE-JSON-URL-Encoded-Text.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/ESP32-HTTP-GET-HTTP-POST-with-Arduino-IDE-JSON-URL-Encoded-Text.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/ESP32-HTTP-GET-HTTP-POST-with-Arduino-IDE-JSON-URL-Encoded-Text.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n<p><strong>Recommended:<\/strong> <a href=\"https:\/\/randomnerdtutorials.com\/esp8266-nodemcu-http-get-post-arduino\/\">ESP8266 NodeMCU HTTP GET and HTTP POST with Arduino IDE (JSON, URL Encoded, Text)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">HTTP Request Methods: GET vs POST<\/h2>\n\n\n\n<p>The Hypertext Transfer Protocol (HTTP) works as a request-response protocol between a client and server. Here&#8217;s an example:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The ESP32 (client) submits an HTTP request to a Raspberry Pi running Node-RED (server);<\/li><li>The server returns a response to the ESP32 (client);<\/li><li>Finally, the response contains status information about the request and may also contain the requested content.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">HTTP GET<\/h3>\n\n\n\n<p><strong>GET <\/strong>is used to request data from a specified resource. It is often used to get values from APIs.<\/p>\n\n\n\n<p>For example, you can have:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GET \/update-sensor?temperature=value1<\/code><\/pre>\n\n\n\n<p>Note that the query string (<em>name = temperature<\/em> and <em>value = value1<\/em>) is sent in the URL of the HTTP GET request.<\/p>\n\n\n\n<p>Or you can use a simple request to return a value or JSON object, for example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GET \/get-sensor<\/code><\/pre>\n\n\n\n<p><em>(With HTTP GET, data is visible to everyone in the URL request.)<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">HTTP POST<\/h3>\n\n\n\n<p><strong>POST <\/strong>is used to send data to a server to create\/update a resource. For example, publish sensor readings to a server.<\/p>\n\n\n\n<p>The data sent to the server with POST is stored in the request body of the HTTP request:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>POST \/update-sensor HTTP\/1.1\nHost: example.com\napi_key=api&amp;sensor_name=name&amp;temperature=value1&amp;humidity=value2&amp;pressure=value3\nContent-Type: application\/x-www-form-urlencoded<\/code><\/pre>\n\n\n\n<p>In the body request, you can also send a JSON object:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>POST \/update-sensor HTTP\/1.1\nHost: example.com\n{api_key: \"api\", sensor_name: \"name\", temperature: value1, humidity: value2, pressure: value3}\nContent-Type: application\/json<\/code><\/pre>\n\n\n\n<p><em>(With HTTP POST, data is not visible in the URL request. However, if it&#8217;s not encrypted, it&#8217;s still visible in the request body.)<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">HTTP GET\/POST with ESP32<\/h3>\n\n\n\n<p>In this guide, we&#8217;ll explore the following scenarios:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><a href=\"#http-get-1\">ESP32 HTTP GET: Value or Query in URL<\/a><\/li><li><a href=\"#http-get-2\">ESP32 HTTP GET: JSON Data Object or Plain Text<\/a><\/li><li><a href=\"#http-post\">ESP32 HTTP POST: URL Encoded, JSON Data Object, Plain Text<\/a><\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>Before proceeding with this tutorial, make sure you complete the following prerequisites.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Arduino IDE<\/h3>\n\n\n\n<p>We&#8217;ll program the ESP32 using Arduino IDE, so make sure you have the ESP32 add-on installed.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/randomnerdtutorials.com\/installing-the-esp32-board-in-arduino-ide-windows-instructions\/\">Installing the ESP32 Board in Arduino IDE (Windows, Mac OS X, Linux)<\/a><\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Arduino_JSON Library<\/h3>\n\n\n\n<p>You also need to install the&nbsp;<a href=\"https:\/\/github.com\/arduino-libraries\/Arduino_JSON\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Arduino_JSON library<\/a>. You can install this library in the Arduino IDE Library Manager. Just go to&nbsp;<strong>Sketch&nbsp;<\/strong>&gt;&nbsp;<strong>Include Library<\/strong>&nbsp;&gt;&nbsp;<strong>Manage Libraries<\/strong>&nbsp;and search for the library name as follows:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"786\" height=\"443\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/01\/Install-Arduino-JSON-library-Arduino-IDE.png?resize=786%2C443&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Install Arduino JSON library Arduino IDE\" class=\"wp-image-93172\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/01\/Install-Arduino-JSON-library-Arduino-IDE.png?w=786&amp;quality=100&amp;strip=all&amp;ssl=1 786w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/01\/Install-Arduino-JSON-library-Arduino-IDE.png?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/01\/Install-Arduino-JSON-library-Arduino-IDE.png?resize=768%2C433&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">Parts Required<\/h3>\n\n\n\n<p>For this tutorial you need the following parts:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a rel=\"noreferrer noopener\" href=\"https:\/\/makeradvisor.com\/tools\/esp32-dev-board-wi-fi-bluetooth\/\" target=\"_blank\">ESP32<\/a>&nbsp;(read&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/makeradvisor.com\/tools\/esp32-dev-board-wi-fi-bluetooth\/\" target=\"_blank\">Best ESP32 development boards<\/a>)<\/li><li><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/raspberry-pi-board\/\" target=\"_blank\">Raspberry Pi board<\/a>&nbsp;(read&nbsp;<a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/best-raspberry-pi-starter-kits\/\" target=\"_blank\">Best Raspberry Pi Starter Kits<\/a>)<\/li><li><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/microsd-card-raspberry-pi-16gb-class-10\/\" target=\"_blank\">MicroSD Card \u2013 16GB Class10<\/a><\/li><li><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/raspberry-pi-power-supply\/\" target=\"_blank\">Raspberry Pi Power Supply (5V 2.5A)<\/a> <\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/makeradvisor.com\/tools\/jumper-wires-kit-120-pieces\/\" target=\"_blank\">Jumper wires<\/a><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/makeradvisor.com\/tools\/mb-102-solderless-breadboard-830-points\/\" target=\"_blank\">Breadboard<\/a> <\/li><\/ul>\n\n\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Preparing Node-RED (optional)<\/h3>\n\n\n\n<p>As an example, we&#8217;ll create a web service with a Raspberry Pi and Node-RED to act as a web service (like an API). Basically, you&#8217;ll make HTTP GET and HTTP POST requests to your Raspberry Pi to get values or update them. You can use any other web service.<\/p>\n\n\n\n<p>If you don&#8217;t have Node-RED installed, follow the next tutorials:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-with-node-red-on-raspberry-pi\/\">Getting Started with Node-RED on Raspberry Pi<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-with-node-red-dashboard\/\">Installing and Getting Started with Node-RED Dashboard<\/a><\/li><\/ul>\n\n\n\n<p>Having Node-RED running on your Raspberry Pi, go to your Raspberry Pi IP address followed by :1880.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;raspberry-pi-ip-address:1880<\/code><\/pre>\n\n\n\n<p>The Node-RED interface should open. You can simply import the final flow:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"854\" height=\"566\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/Node-RED-Flow-HTTP-GET-POST-Request-Methods-ESP32-ESP8266-Arduino.png?resize=854%2C566&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Node-RED-Flow-HTTP-GET-POST-Request-Methods-ESP32-ESP8266-Arduino\" class=\"wp-image-95509\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/Node-RED-Flow-HTTP-GET-POST-Request-Methods-ESP32-ESP8266-Arduino.png?w=854&amp;quality=100&amp;strip=all&amp;ssl=1 854w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/Node-RED-Flow-HTTP-GET-POST-Request-Methods-ESP32-ESP8266-Arduino.png?resize=300%2C199&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/Node-RED-Flow-HTTP-GET-POST-Request-Methods-ESP32-ESP8266-Arduino.png?resize=768%2C509&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 854px) 100vw, 854px\" \/><\/figure><\/div>\n\n\n<p>Go to <strong>Menu<\/strong> &gt; <strong>Import<\/strong> and copy the following to your Clipboard to create your Node-RED flow.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">[{&quot;id&quot;:&quot;599740b7.efde9&quot;,&quot;type&quot;:&quot;http response&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;name&quot;:&quot;&quot;,&quot;statusCode&quot;:&quot;200&quot;,&quot;headers&quot;:{},&quot;x&quot;:420,&quot;y&quot;:689,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;1618a829.76f638&quot;,&quot;type&quot;:&quot;json&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;name&quot;:&quot;&quot;,&quot;property&quot;:&quot;payload&quot;,&quot;action&quot;:&quot;obj&quot;,&quot;pretty&quot;:true,&quot;x&quot;:410,&quot;y&quot;:809,&quot;wires&quot;:[[&quot;d0089cc7.d25ac&quot;]]},{&quot;id&quot;:&quot;c7410fa2.1c2fa&quot;,&quot;type&quot;:&quot;debug&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;name&quot;:&quot;&quot;,&quot;active&quot;:true,&quot;tosidebar&quot;:true,&quot;console&quot;:false,&quot;tostatus&quot;:false,&quot;complete&quot;:&quot;false&quot;,&quot;x&quot;:850,&quot;y&quot;:709,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;75a22f74.f1aba&quot;,&quot;type&quot;:&quot;ui_text&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;group&quot;:&quot;2b7ac01b.fc984&quot;,&quot;order&quot;:1,&quot;width&quot;:0,&quot;height&quot;:0,&quot;name&quot;:&quot;&quot;,&quot;label&quot;:&quot;Sensor Name&quot;,&quot;format&quot;:&quot;{{msg.payload}}&quot;,&quot;layout&quot;:&quot;row-spread&quot;,&quot;x&quot;:860,&quot;y&quot;:769,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;1c8f9093.8bc2bf&quot;,&quot;type&quot;:&quot;ui_gauge&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;name&quot;:&quot;&quot;,&quot;group&quot;:&quot;2b7ac01b.fc984&quot;,&quot;order&quot;:2,&quot;width&quot;:0,&quot;height&quot;:0,&quot;gtype&quot;:&quot;gage&quot;,&quot;title&quot;:&quot;Temperature&quot;,&quot;label&quot;:&quot;\u00baC&quot;,&quot;format&quot;:&quot;{{value}}&quot;,&quot;min&quot;:0,&quot;max&quot;:&quot;38&quot;,&quot;colors&quot;:[&quot;#00b500&quot;,&quot;#e6e600&quot;,&quot;#ca3838&quot;],&quot;seg1&quot;:&quot;&quot;,&quot;seg2&quot;:&quot;&quot;,&quot;x&quot;:850,&quot;y&quot;:829,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;a5bd2706.54e108&quot;,&quot;type&quot;:&quot;ui_gauge&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;name&quot;:&quot;&quot;,&quot;group&quot;:&quot;2b7ac01b.fc984&quot;,&quot;order&quot;:3,&quot;width&quot;:0,&quot;height&quot;:0,&quot;gtype&quot;:&quot;gage&quot;,&quot;title&quot;:&quot;Humidity&quot;,&quot;label&quot;:&quot;%&quot;,&quot;format&quot;:&quot;{{value}}&quot;,&quot;min&quot;:0,&quot;max&quot;:&quot;100&quot;,&quot;colors&quot;:[&quot;#0080ff&quot;,&quot;#0062c4&quot;,&quot;#002f5e&quot;],&quot;seg1&quot;:&quot;&quot;,&quot;seg2&quot;:&quot;&quot;,&quot;x&quot;:840,&quot;y&quot;:889,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;105ac2cc.7b3cfd&quot;,&quot;type&quot;:&quot;ui_gauge&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;name&quot;:&quot;&quot;,&quot;group&quot;:&quot;2b7ac01b.fc984&quot;,&quot;order&quot;:4,&quot;width&quot;:0,&quot;height&quot;:0,&quot;gtype&quot;:&quot;gage&quot;,&quot;title&quot;:&quot;Pressure&quot;,&quot;label&quot;:&quot;hPa&quot;,&quot;format&quot;:&quot;{{value}}&quot;,&quot;min&quot;:0,&quot;max&quot;:&quot;1200&quot;,&quot;colors&quot;:[&quot;#b366ff&quot;,&quot;#8000ff&quot;,&quot;#440088&quot;],&quot;seg1&quot;:&quot;&quot;,&quot;seg2&quot;:&quot;&quot;,&quot;x&quot;:840,&quot;y&quot;:949,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;d0089cc7.d25ac&quot;,&quot;type&quot;:&quot;function&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;name&quot;:&quot;JSON or URL Encoded&quot;,&quot;func&quot;:&quot;var msg0 = { payload: msg.payload.api_key };\\nvar msg1 = { payload: msg.payload.sensor };\\nvar msg2 = { payload: msg.payload.value1 };\\nvar msg3 = { payload: msg.payload.value2 };\\nvar msg4 = { payload: msg.payload.value3 };\\n\\nreturn [msg0, msg1, msg2, msg3, msg4];&quot;,&quot;outputs&quot;:5,&quot;noerr&quot;:0,&quot;x&quot;:610,&quot;y&quot;:809,&quot;wires&quot;:[[&quot;c7410fa2.1c2fa&quot;],[&quot;75a22f74.f1aba&quot;],[&quot;1c8f9093.8bc2bf&quot;],[&quot;a5bd2706.54e108&quot;],[&quot;105ac2cc.7b3cfd&quot;]]},{&quot;id&quot;:&quot;5d9ab0d2.66b92&quot;,&quot;type&quot;:&quot;http in&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;name&quot;:&quot;&quot;,&quot;url&quot;:&quot;update-sensor&quot;,&quot;method&quot;:&quot;post&quot;,&quot;upload&quot;:false,&quot;swaggerDoc&quot;:&quot;&quot;,&quot;x&quot;:200,&quot;y&quot;:740,&quot;wires&quot;:[[&quot;599740b7.efde9&quot;,&quot;c7410fa2.1c2fa&quot;,&quot;1618a829.76f638&quot;]]},{&quot;id&quot;:&quot;7f5cf345.63f56c&quot;,&quot;type&quot;:&quot;http response&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;name&quot;:&quot;&quot;,&quot;statusCode&quot;:&quot;200&quot;,&quot;headers&quot;:{},&quot;x&quot;:540,&quot;y&quot;:420,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;6530621.95b429c&quot;,&quot;type&quot;:&quot;http in&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;name&quot;:&quot;&quot;,&quot;url&quot;:&quot;\/get-sensor&quot;,&quot;method&quot;:&quot;get&quot;,&quot;upload&quot;:false,&quot;swaggerDoc&quot;:&quot;&quot;,&quot;x&quot;:180,&quot;y&quot;:600,&quot;wires&quot;:[[&quot;9471d1a0.68588&quot;]]},{&quot;id&quot;:&quot;5ddc9f47.4b555&quot;,&quot;type&quot;:&quot;http response&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;name&quot;:&quot;&quot;,&quot;statusCode&quot;:&quot;200&quot;,&quot;headers&quot;:{},&quot;x&quot;:540,&quot;y&quot;:560,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;9471d1a0.68588&quot;,&quot;type&quot;:&quot;function&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;name&quot;:&quot;&quot;,&quot;func&quot;:&quot;msg.payload = {\\&quot;value1\\&quot;:24.25, \\&quot;value2\\&quot;:49.54, \\&quot;value3\\&quot;:1005.14};\\nreturn msg;&quot;,&quot;outputs&quot;:1,&quot;noerr&quot;:0,&quot;x&quot;:350,&quot;y&quot;:600,&quot;wires&quot;:[[&quot;5ddc9f47.4b555&quot;,&quot;13aea59.7430e5a&quot;]]},{&quot;id&quot;:&quot;13aea59.7430e5a&quot;,&quot;type&quot;:&quot;debug&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;name&quot;:&quot;&quot;,&quot;active&quot;:true,&quot;tosidebar&quot;:true,&quot;console&quot;:false,&quot;tostatus&quot;:false,&quot;complete&quot;:&quot;false&quot;,&quot;x&quot;:550,&quot;y&quot;:628,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;e71c7a7d.e7c598&quot;,&quot;type&quot;:&quot;debug&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;name&quot;:&quot;&quot;,&quot;active&quot;:true,&quot;tosidebar&quot;:true,&quot;console&quot;:false,&quot;tostatus&quot;:false,&quot;complete&quot;:&quot;false&quot;,&quot;x&quot;:550,&quot;y&quot;:500,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;c7807102.3f433&quot;,&quot;type&quot;:&quot;http in&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;name&quot;:&quot;&quot;,&quot;url&quot;:&quot;\/update-sensor&quot;,&quot;method&quot;:&quot;get&quot;,&quot;upload&quot;:false,&quot;swaggerDoc&quot;:&quot;&quot;,&quot;x&quot;:190,&quot;y&quot;:460,&quot;wires&quot;:[[&quot;60410cde.562a34&quot;]]},{&quot;id&quot;:&quot;60410cde.562a34&quot;,&quot;type&quot;:&quot;function&quot;,&quot;z&quot;:&quot;b01416d3.f69f38&quot;,&quot;name&quot;:&quot;&quot;,&quot;func&quot;:&quot;msg.payload = msg.payload.temperature;\\nreturn msg;&quot;,&quot;outputs&quot;:1,&quot;noerr&quot;:0,&quot;x&quot;:390,&quot;y&quot;:460,&quot;wires&quot;:[[&quot;e71c7a7d.e7c598&quot;,&quot;7f5cf345.63f56c&quot;]]},{&quot;id&quot;:&quot;2b7ac01b.fc984&quot;,&quot;type&quot;:&quot;ui_group&quot;,&quot;z&quot;:&quot;&quot;,&quot;name&quot;:&quot;SENSORS&quot;,&quot;tab&quot;:&quot;99ab8dc5.f435c&quot;,&quot;disp&quot;:true,&quot;width&quot;:&quot;6&quot;,&quot;collapse&quot;:false},{&quot;id&quot;:&quot;99ab8dc5.f435c&quot;,&quot;type&quot;:&quot;ui_tab&quot;,&quot;z&quot;:&quot;&quot;,&quot;name&quot;:&quot;HTTP&quot;,&quot;icon&quot;:&quot;dashboard&quot;,&quot;order&quot;:1,&quot;disabled&quot;:false,&quot;hidden&quot;:false}]\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP32\/HTTP\/HTTP_NodeRED_Flow.txt\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Other Web Services or APIs<\/h3>\n\n\n\n<p>In this guide, the ESP32 performs HTTP requests to Node-RED, but you can use these examples with other services like <a href=\"https:\/\/randomnerdtutorials.com\/esp32-http-get-open-weather-map-thingspeak-arduino\/\">ThingSpeak<\/a>, <a href=\"https:\/\/randomnerdtutorials.com\/esp32-http-post-ifttt-thingspeak-arduino\/\">IFTTT.com<\/a> (WebHooks service), <a href=\"https:\/\/randomnerdtutorials.com\/esp32-http-get-open-weather-map-thingspeak-arduino\/\">OpenWeatherMap.org<\/a>, <a href=\"https:\/\/randomnerdtutorials.com\/control-esp32-esp8266-gpios-from-anywhere\/\">PHP server<\/a>, etc&#8230; All examples presented in this guide will also work with other APIs.<\/p>\n\n\n\n<p>In summary, to make this guide compatible with any service, you need to search for the service API documentation. Then, you need the server name (URL or IP address), and parameters to send in the request (URL path or request body). Finally, modify our examples to integrate with any API you want to use.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"http-get-1\">1. ESP32 HTTP GET: Value or Query in URL<\/h2>\n\n\n\n<p>In the first example, the ESP32 will make an HTTP GET request to update a reading in a service. This type of request could also be used to filter a value, request a value, or return a JSON object.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"426\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/HTTP-GET-ESP32-Get-Sensor-Value-Plain-Text-OK.png?resize=900%2C426&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"HTTP GET ESP32 Get Sensor Value Plain Text Status 200 OK\" class=\"wp-image-95588\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/HTTP-GET-ESP32-Get-Sensor-Value-Plain-Text-OK.png?w=900&amp;quality=100&amp;strip=all&amp;ssl=1 900w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/HTTP-GET-ESP32-Get-Sensor-Value-Plain-Text-OK.png?resize=300%2C142&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/HTTP-GET-ESP32-Get-Sensor-Value-Plain-Text-OK.png?resize=768%2C364&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">Code ESP32 HTTP GET with Arduino IDE<\/h3>\n\n\n\n<p>After installing the necessary board add-ons and libraries, copy the following code to your Arduino IDE, but don\u2019t upload it yet. You need to make some changes to make it work for you.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*\r\n  Rui Santos\r\n  Complete project details at Complete project details at https:\/\/RandomNerdTutorials.com\/esp32-http-get-post-arduino\/\r\n\r\n  Permission is hereby granted, free of charge, to any person obtaining a copy\r\n  of this software and associated documentation files.\r\n\r\n  The above copyright notice and this permission notice shall be included in all\r\n  copies or substantial portions of the Software.\r\n*\/\r\n\r\n#include &lt;WiFi.h&gt;\r\n#include &lt;HTTPClient.h&gt;\r\n\r\nconst char* ssid = &quot;REPLACE_WITH_YOUR_SSID&quot;;\r\nconst char* password = &quot;REPLACE_WITH_YOUR_PASSWORD&quot;;\r\n\r\n\/\/Your Domain name with URL path or IP address with path\r\nString serverName = &quot;http:\/\/192.168.1.106:1880\/update-sensor&quot;;\r\n\r\n\/\/ the following variables are unsigned longs because the time, measured in\r\n\/\/ milliseconds, will quickly become a bigger number than can be stored in an int.\r\nunsigned long lastTime = 0;\r\n\/\/ Timer set to 10 minutes (600000)\r\n\/\/unsigned long timerDelay = 600000;\r\n\/\/ Set timer to 5 seconds (5000)\r\nunsigned long timerDelay = 5000;\r\n\r\nvoid setup() {\r\n  Serial.begin(115200); \r\n\r\n  WiFi.begin(ssid, password);\r\n  Serial.println(&quot;Connecting&quot;);\r\n  while(WiFi.status() != WL_CONNECTED) {\r\n    delay(500);\r\n    Serial.print(&quot;.&quot;);\r\n  }\r\n  Serial.println(&quot;&quot;);\r\n  Serial.print(&quot;Connected to WiFi network with IP Address: &quot;);\r\n  Serial.println(WiFi.localIP());\r\n \r\n  Serial.println(&quot;Timer set to 5 seconds (timerDelay variable), it will take 5 seconds before publishing the first reading.&quot;);\r\n}\r\n\r\nvoid loop() {\r\n  \/\/Send an HTTP POST request every 10 minutes\r\n  if ((millis() - lastTime) &gt; timerDelay) {\r\n    \/\/Check WiFi connection status\r\n    if(WiFi.status()== WL_CONNECTED){\r\n      HTTPClient http;\r\n\r\n      String serverPath = serverName + &quot;?temperature=24.37&quot;;\r\n      \r\n      \/\/ Your Domain name with URL path or IP address with path\r\n      http.begin(serverPath.c_str());\r\n      \r\n      \/\/ If you need Node-RED\/server authentication, insert user and password below\r\n      \/\/http.setAuthorization(&quot;REPLACE_WITH_SERVER_USERNAME&quot;, &quot;REPLACE_WITH_SERVER_PASSWORD&quot;);\r\n      \r\n      \/\/ Send HTTP GET request\r\n      int httpResponseCode = http.GET();\r\n      \r\n      if (httpResponseCode&gt;0) {\r\n        Serial.print(&quot;HTTP Response code: &quot;);\r\n        Serial.println(httpResponseCode);\r\n        String payload = http.getString();\r\n        Serial.println(payload);\r\n      }\r\n      else {\r\n        Serial.print(&quot;Error code: &quot;);\r\n        Serial.println(httpResponseCode);\r\n      }\r\n      \/\/ Free resources\r\n      http.end();\r\n    }\r\n    else {\r\n      Serial.println(&quot;WiFi Disconnected&quot;);\r\n    }\r\n    lastTime = millis();\r\n  }\r\n}\r\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP32\/HTTP\/ESP32_HTTP_GET_Update.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Setting your network credentials<\/h4>\n\n\n\n<p>Modify the next lines with your network credentials: SSID and password. The code is well commented on where you should make the changes.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Replace with your network credentials\nconst char* ssid     = \"REPLACE_WITH_YOUR_SSID\";\nconst char* password = \"REPLACE_WITH_YOUR_PASSWORD\";<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Setting your serverName<\/h4>\n\n\n\n<p>You also need to type your domain name or Node-RED IP address, so the ESP publishes the readings to your own server.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>String serverName = \"http:\/\/192.168.1.106:1880\/update-sensor\";<\/code><\/pre>\n\n\n\n<p>Now, upload the code to your board and it should work straight away. <\/p>\n\n\n\n<p>Read the next section, if you want to learn how to make the HTTP GET request.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">HTTP GET Request<\/h4>\n\n\n\n<p>In the <span class=\"rnthl rntliteral\">loop()<\/span> is where you actually make the HTTP GET request every 5 seconds with sample data:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>String serverPath = serverName + \"?temperature=24.37\";\n\n\/\/ Your Domain name with URL path or IP address with path\nhttp.begin(serverPath.c_str());\n\n\/\/ If your need Node-RED\/server authentication, insert user and password below\n\/\/http.setAuthorization(\"REPLACE_WITH_SERVER_USERNAME\", \"REPLACE_WITH_SERVER_PASSWORD\");\n\n\/\/ Send HTTP GET request\nint httpResponseCode = http.GET();<\/code><\/pre>\n\n\n\n<p>Note: if Node-RED requires authentication, uncomment the following line and insert the Node-RED username and password.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ If you need Node-RED\/server authentication, insert user and password below\n\/\/http.setAuthorization(\"REPLACE_WITH_SERVER_USERNAME\", \"REPLACE_WITH_SERVER_PASSWORD\");<\/code><\/pre>\n\n\n\n<p>The ESP32 makes a new request in the following URL to update the sensor field with a new temperature.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;192.168.1.106:1880\/update-sensor?temperature=24.37<\/code><\/pre>\n\n\n\n<p>Then, the following lines of code save the HTTP response from the server.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>if (httpResponseCode&gt;0) {\n  Serial.print(\"HTTP Response code: \");\n  Serial.println(httpResponseCode);\n  String payload = http.getString();\n  Serial.println(payload);\n}\nelse {\n  Serial.print(\"Error code: \");\n  Serial.println(httpResponseCode);\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Demonstration<\/h3>\n\n\n\n<p>With your board running the new sketch, open the Node-RED debug window. You&#8217;ll see that the sample values are being printed successfully (24.37).<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"302\" height=\"220\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/udpate-data-esp32-HTTP-GET-ESP8266-NodeMCU-Arduino-value.png?resize=302%2C220&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-95521\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/udpate-data-esp32-HTTP-GET-ESP8266-NodeMCU-Arduino-value.png?w=302&amp;quality=100&amp;strip=all&amp;ssl=1 302w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/udpate-data-esp32-HTTP-GET-ESP8266-NodeMCU-Arduino-value.png?resize=300%2C219&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 302px) 100vw, 302px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"http-get-2\">2. ESP32 HTTP GET: JSON Data Object or Plain Text<\/h2>\n\n\n\n<p>This next example shows how to make an HTTP GET request to get a JSON object and decode it with the ESP32. Many APIs return data in JSON format.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"426\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/HTTP-GET-ESP32-Get-Sensor-JSON-Data.png?resize=900%2C426&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"HTTP GET ESP32 Get Sensor JSON Data\" class=\"wp-image-95504\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/HTTP-GET-ESP32-Get-Sensor-JSON-Data.png?w=900&amp;quality=100&amp;strip=all&amp;ssl=1 900w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/HTTP-GET-ESP32-Get-Sensor-JSON-Data.png?resize=300%2C142&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/HTTP-GET-ESP32-Get-Sensor-JSON-Data.png?resize=768%2C364&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/figure><\/div>\n\n\n<p>Copy the next sketch to your Arduino IDE (type your SSID and password):<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*\r\n  Rui Santos\r\n  Complete project details at Complete project details at https:\/\/RandomNerdTutorials.com\/esp32-http-get-post-arduino\/\r\n\r\n  Permission is hereby granted, free of charge, to any person obtaining a copy\r\n  of this software and associated documentation files.\r\n\r\n  The above copyright notice and this permission notice shall be included in all\r\n  copies or substantial portions of the Software.\r\n*\/\r\n\r\n#include &lt;WiFi.h&gt;\r\n#include &lt;HTTPClient.h&gt;\r\n#include &lt;Arduino_JSON.h&gt;\r\n\r\nconst char* ssid = &quot;REPLACE_WITH_YOUR_SSID&quot;;\r\nconst char* password = &quot;REPLACE_WITH_YOUR_PASSWORD&quot;;\r\n\r\n\/\/Your Domain name with URL path or IP address with path\r\nconst char* serverName = &quot;http:\/\/192.168.1.106:1880\/get-sensor&quot;;\r\n\r\n\/\/ the following variables are unsigned longs because the time, measured in\r\n\/\/ milliseconds, will quickly become a bigger number than can be stored in an int.\r\nunsigned long lastTime = 0;\r\n\/\/ Timer set to 10 minutes (600000)\r\n\/\/unsigned long timerDelay = 600000;\r\n\/\/ Set timer to 5 seconds (5000)\r\nunsigned long timerDelay = 5000;\r\n\r\nString sensorReadings;\r\nfloat sensorReadingsArr[3];\r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n\r\n  WiFi.begin(ssid, password);\r\n  Serial.println(&quot;Connecting&quot;);\r\n  while(WiFi.status() != WL_CONNECTED) {\r\n    delay(500);\r\n    Serial.print(&quot;.&quot;);\r\n  }\r\n  Serial.println(&quot;&quot;);\r\n  Serial.print(&quot;Connected to WiFi network with IP Address: &quot;);\r\n  Serial.println(WiFi.localIP());\r\n \r\n  Serial.println(&quot;Timer set to 5 seconds (timerDelay variable), it will take 5 seconds before publishing the first reading.&quot;);\r\n}\r\n\r\nvoid loop() {\r\n  \/\/Send an HTTP POST request every 10 minutes\r\n  if ((millis() - lastTime) &gt; timerDelay) {\r\n    \/\/Check WiFi connection status\r\n    if(WiFi.status()== WL_CONNECTED){\r\n              \r\n      sensorReadings = httpGETRequest(serverName);\r\n      Serial.println(sensorReadings);\r\n      JSONVar myObject = JSON.parse(sensorReadings);\r\n  \r\n      \/\/ JSON.typeof(jsonVar) can be used to get the type of the var\r\n      if (JSON.typeof(myObject) == &quot;undefined&quot;) {\r\n        Serial.println(&quot;Parsing input failed!&quot;);\r\n        return;\r\n      }\r\n    \r\n      Serial.print(&quot;JSON object = &quot;);\r\n      Serial.println(myObject);\r\n    \r\n      \/\/ myObject.keys() can be used to get an array of all the keys in the object\r\n      JSONVar keys = myObject.keys();\r\n    \r\n      for (int i = 0; i &lt; keys.length(); i++) {\r\n        JSONVar value = myObject[keys[i]];\r\n        Serial.print(keys[i]);\r\n        Serial.print(&quot; = &quot;);\r\n        Serial.println(value);\r\n        sensorReadingsArr[i] = double(value);\r\n      }\r\n      Serial.print(&quot;1 = &quot;);\r\n      Serial.println(sensorReadingsArr[0]);\r\n      Serial.print(&quot;2 = &quot;);\r\n      Serial.println(sensorReadingsArr[1]);\r\n      Serial.print(&quot;3 = &quot;);\r\n      Serial.println(sensorReadingsArr[2]);\r\n    }\r\n    else {\r\n      Serial.println(&quot;WiFi Disconnected&quot;);\r\n    }\r\n    lastTime = millis();\r\n  }\r\n}\r\n\r\nString httpGETRequest(const char* serverName) {\r\n  WiFiClient client;\r\n  HTTPClient http;\r\n    \r\n  \/\/ Your Domain name with URL path or IP address with path\r\n  http.begin(client, serverName);\r\n  \r\n  \/\/ If you need Node-RED\/server authentication, insert user and password below\r\n  \/\/http.setAuthorization(&quot;REPLACE_WITH_SERVER_USERNAME&quot;, &quot;REPLACE_WITH_SERVER_PASSWORD&quot;);\r\n  \r\n  \/\/ Send HTTP POST request\r\n  int httpResponseCode = http.GET();\r\n  \r\n  String payload = &quot;{}&quot;; \r\n  \r\n  if (httpResponseCode&gt;0) {\r\n    Serial.print(&quot;HTTP Response code: &quot;);\r\n    Serial.println(httpResponseCode);\r\n    payload = http.getString();\r\n  }\r\n  else {\r\n    Serial.print(&quot;Error code: &quot;);\r\n    Serial.println(httpResponseCode);\r\n  }\r\n  \/\/ Free resources\r\n  http.end();\r\n\r\n  return payload;\r\n}\r\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP32\/HTTP\/ESP32_HTTP_GET_JSON.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Setting your serverName<\/h3>\n\n\n\n<p>Enter your domain name or Node-RED IP address, so the ESP requests the sensor readings that will be retrieved in a JSON object.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>String serverName = \"http:\/\/192.168.1.106:1880\/get-sensor\";<\/code><\/pre>\n\n\n\n<p>Now, upload the code to your board.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">HTTP GET Request (JSON Object)<\/h3>\n\n\n\n<p>In the <span class=\"rnthl rntliteral\">loop()<\/span>, call the <span class=\"rnthl rntliteral\">httpGETRequest()<\/span> function to make the HTTP GET request:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>sensorReadings = httpGETRequest(serverName);<\/code><\/pre>\n\n\n\n<p>The <span class=\"rnthl rntliteral\">httpGETRequest()<\/span> function makes a request to Node-RED address <em>http:\/\/192.168.1.106:1880\/get-sensor<\/em> and it retrieves a string with a JSON object.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>String httpGETRequest(const char* serverName) {\n  HTTPClient http;\n\n  \/\/ Your IP address with path or Domain name with URL path \n  http.begin(serverName);\n\n  \/\/ If you need Node-RED\/server authentication, insert user and password below\n  \/\/http.setAuthorization(\"REPLACE_WITH_SERVER_USERNAME\", \"REPLACE_WITH_SERVER_PASSWORD\");\n\n\n  \/\/ Send HTTP POST request\n  int httpResponseCode = http.GET();\n\n  String payload = \"{}\"; \n\n  if (httpResponseCode>0) {\n    Serial.print(\"HTTP Response code: \");\n    Serial.println(httpResponseCode);\n    payload = http.getString();\n  }\n  else {\n    Serial.print(\"Error code: \");\n    Serial.println(httpResponseCode);\n  }\n  \/\/ Free resources\n  http.end();\n\n  return payload;\n}<\/code><\/pre>\n\n\n\n<p>Note: if Node-RED requires authentication, uncomment the following line and insert the Node-RED username and password.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ If you need Node-RED\/server authentication, insert user and password below\n\/\/http.setAuthorization(\"REPLACE_WITH_SERVER_USERNAME\", \"REPLACE_WITH_SERVER_PASSWORD\");<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Decoding JSON Object<\/h3>\n\n\n\n<p>To get access to the values, decode the JSON object and store all values in the <span class=\"rnthl rntliteral\">sensorReadingsArr<\/span> array.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>JSONVar myObject = JSON.parse(sensorReadings);\n\n\/\/ JSON.typeof(jsonVar) can be used to get the type of the var\nif (JSON.typeof(myObject) == \"undefined\") {\n  Serial.println(\"Parsing input failed!\");\n  return;\n}\n\nSerial.print(\"JSON object = \");\nSerial.println(myObject);\n\n\/\/ myObject.keys() can be used to get an array of all the keys in the object\nJSONVar keys = myObject.keys();\n\nfor (int i = 0; i &lt; keys.length(); i++) {\n  JSONVar value = myObject&#091;keys&#091;i]];\n  Serial.print(keys&#091;i]);\n  Serial.print(\" = \");\n  Serial.println(value);\n  sensorReadingsArr&#091;i] = double(value);\n}\nSerial.print(\"1 = \");\nSerial.println(sensorReadingsArr&#091;0]);\nSerial.print(\"2 = \");\nSerial.println(sensorReadingsArr&#091;1]);\nSerial.print(\"3 = \");\nSerial.println(sensorReadingsArr&#091;2]);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">HTTP GET Demonstration<\/h3>\n\n\n\n<p>After uploading the code, open the Arduino IDE and you&#8217;ll see that it&#8217;s receiving the following JSON data:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\"value1\":24.25,\"value2\":49.54,\"value3\":1005.14}<\/code><\/pre>\n\n\n\n<p>Then, you print the decoded JSON object in the Arduino IDE Serial Monitor.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"859\" height=\"396\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/JSON-Data-object-HTTP-POST-Request-Method.png?resize=859%2C396&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-95519\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/JSON-Data-object-HTTP-POST-Request-Method.png?w=859&amp;quality=100&amp;strip=all&amp;ssl=1 859w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/JSON-Data-object-HTTP-POST-Request-Method.png?resize=300%2C138&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/JSON-Data-object-HTTP-POST-Request-Method.png?resize=768%2C354&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 859px) 100vw, 859px\" \/><\/figure><\/div>\n\n\n<p>For debugging purposes, the requested information is also printed in the Node-RED debug window.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"434\" height=\"221\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/udpate-data-esp32-HTTP-GET-ESP8266-NodeMCU-Arduino-JSON-object.png?resize=434%2C221&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-95520\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/udpate-data-esp32-HTTP-GET-ESP8266-NodeMCU-Arduino-JSON-object.png?w=434&amp;quality=100&amp;strip=all&amp;ssl=1 434w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/udpate-data-esp32-HTTP-GET-ESP8266-NodeMCU-Arduino-JSON-object.png?resize=300%2C153&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 434px) 100vw, 434px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"http-post\">3. ESP32 HTTP POST: URL Encoded, JSON Data Object, Plain Text<\/h2>\n\n\n\n<p>Finally, you&#8217;ll learn how to make an HTTP POST request with an ESP32.<\/p>\n\n\n\n<p>With this example, your ESP32 can make HTTP POST requests using three different types of body requests: URL encoded, JSON object or plain text. These are the most common methods and should integrate with most APIs or web services.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"426\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/HTTP-POST-ESP32-URL-Encoded-JSON-Object-Data-Plain-Text.png?resize=900%2C426&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"HTTP POST ESP32 URL Encoded JSON Object Data Plain Text\" class=\"wp-image-95506\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/HTTP-POST-ESP32-URL-Encoded-JSON-Object-Data-Plain-Text.png?w=900&amp;quality=100&amp;strip=all&amp;ssl=1 900w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/HTTP-POST-ESP32-URL-Encoded-JSON-Object-Data-Plain-Text.png?resize=300%2C142&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/HTTP-POST-ESP32-URL-Encoded-JSON-Object-Data-Plain-Text.png?resize=768%2C364&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/figure><\/div>\n\n\n<p>Copy the next sketch to your Arduino IDE (type your SSID and password):<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*\r\n  Rui Santos\r\n  Complete project details at Complete project details at https:\/\/RandomNerdTutorials.com\/esp32-http-get-post-arduino\/\r\n\r\n  Permission is hereby granted, free of charge, to any person obtaining a copy\r\n  of this software and associated documentation files.\r\n\r\n  The above copyright notice and this permission notice shall be included in all\r\n  copies or substantial portions of the Software.\r\n*\/\r\n\r\n#include &lt;WiFi.h&gt;\r\n#include &lt;HTTPClient.h&gt;\r\n\r\nconst char* ssid = &quot;REPLACE_WITH_YOUR_SSID&quot;;\r\nconst char* password = &quot;REPLACE_WITH_YOUR_PASSWORD&quot;;\r\n\r\n\/\/Your Domain name with URL path or IP address with path\r\nconst char* serverName = &quot;http:\/\/192.168.1.106:1880\/update-sensor&quot;;\r\n\r\n\/\/ the following variables are unsigned longs because the time, measured in\r\n\/\/ milliseconds, will quickly become a bigger number than can be stored in an int.\r\nunsigned long lastTime = 0;\r\n\/\/ Timer set to 10 minutes (600000)\r\n\/\/unsigned long timerDelay = 600000;\r\n\/\/ Set timer to 5 seconds (5000)\r\nunsigned long timerDelay = 5000;\r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n\r\n  WiFi.begin(ssid, password);\r\n  Serial.println(&quot;Connecting&quot;);\r\n  while(WiFi.status() != WL_CONNECTED) {\r\n    delay(500);\r\n    Serial.print(&quot;.&quot;);\r\n  }\r\n  Serial.println(&quot;&quot;);\r\n  Serial.print(&quot;Connected to WiFi network with IP Address: &quot;);\r\n  Serial.println(WiFi.localIP());\r\n \r\n  Serial.println(&quot;Timer set to 5 seconds (timerDelay variable), it will take 5 seconds before publishing the first reading.&quot;);\r\n}\r\n\r\nvoid loop() {\r\n  \/\/Send an HTTP POST request every 10 minutes\r\n  if ((millis() - lastTime) &gt; timerDelay) {\r\n    \/\/Check WiFi connection status\r\n    if(WiFi.status()== WL_CONNECTED){\r\n      WiFiClient client;\r\n      HTTPClient http;\r\n    \r\n      \/\/ Your Domain name with URL path or IP address with path\r\n      http.begin(client, serverName);\r\n      \r\n      \/\/ If you need Node-RED\/server authentication, insert user and password below\r\n      \/\/http.setAuthorization(&quot;REPLACE_WITH_SERVER_USERNAME&quot;, &quot;REPLACE_WITH_SERVER_PASSWORD&quot;);\r\n      \r\n      \/\/ Specify content-type header\r\n      http.addHeader(&quot;Content-Type&quot;, &quot;application\/x-www-form-urlencoded&quot;);\r\n      \/\/ Data to send with HTTP POST\r\n      String httpRequestData = &quot;api_key=tPmAT5Ab3j7F9&amp;sensor=BME280&amp;value1=24.25&amp;value2=49.54&amp;value3=1005.14&quot;;           \r\n      \/\/ Send HTTP POST request\r\n      int httpResponseCode = http.POST(httpRequestData);\r\n      \r\n      \/\/ If you need an HTTP request with a content type: application\/json, use the following:\r\n      \/\/http.addHeader(&quot;Content-Type&quot;, &quot;application\/json&quot;);\r\n      \/\/int httpResponseCode = http.POST(&quot;{\\&quot;api_key\\&quot;:\\&quot;tPmAT5Ab3j7F9\\&quot;,\\&quot;sensor\\&quot;:\\&quot;BME280\\&quot;,\\&quot;value1\\&quot;:\\&quot;24.25\\&quot;,\\&quot;value2\\&quot;:\\&quot;49.54\\&quot;,\\&quot;value3\\&quot;:\\&quot;1005.14\\&quot;}&quot;);\r\n\r\n      \/\/ If you need an HTTP request with a content type: text\/plain\r\n      \/\/http.addHeader(&quot;Content-Type&quot;, &quot;text\/plain&quot;);\r\n      \/\/int httpResponseCode = http.POST(&quot;Hello, World!&quot;);\r\n     \r\n      Serial.print(&quot;HTTP Response code: &quot;);\r\n      Serial.println(httpResponseCode);\r\n        \r\n      \/\/ Free resources\r\n      http.end();\r\n    }\r\n    else {\r\n      Serial.println(&quot;WiFi Disconnected&quot;);\r\n    }\r\n    lastTime = millis();\r\n  }\r\n}\r\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP32\/HTTP\/ESP32_HTTP_POST.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Setting your serverName<\/h3>\n\n\n\n<p>Enter your domain name or Node-RED IP address, so the ESP posts sample sensor readings.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>String serverName = \"http:\/\/192.168.1.106:1880\/update-sensor\";<\/code><\/pre>\n\n\n\n<p>Now, upload the code to your board.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">HTTP POST URL Encoded<\/h3>\n\n\n\n<p>To make an HTTP POST request of type URL encoded, like this<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>POST \/update-sensor HTTP\/1.1\nHost: 192.168.1.106:1880\napi_key=tPmAT5Ab3j7F9&amp;sensor=BME280&amp;value1=24.25&amp;value2=49.54&amp;value3=1005.14\nContent-Type: application\/x-www-form-urlencoded<\/code><\/pre>\n\n\n\n<p>You need to run the following in your Arduino code:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Your Domain name with URL path or IP address with path\nhttp.begin(serverName);\n\n\/\/ If you need Node-RED\/server authentication, insert user and password below\r\n\/\/http.setAuthorization(\"REPLACE_WITH_SERVER_USERNAME\", \"REPLACE_WITH_SERVER_PASSWORD\");\n\n\/\/ Specify content-type header\nhttp.addHeader(\"Content-Type\", \"application\/x-www-form-urlencoded\");\n\n\/\/ Data to send with HTTP POST\nString httpRequestData = \"api_key=tPmAT5Ab3j7F9&amp;sensor=BME280&amp;value1=24.25&amp;value2=49.54&amp;value3=1005.14\";\n\n\/\/ Send HTTP POST request\nint httpResponseCode = http.POST(httpRequestData);<\/code><\/pre>\n\n\n\n<p>Note: if Node-RED requires authentication, uncomment the following line and insert the Node-RED username and password.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ If you need Node-RED\/server authentication, insert user and password below\n\/\/http.setAuthorization(\"REPLACE_WITH_SERVER_USERNAME\", \"REPLACE_WITH_SERVER_PASSWORD\");<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">HTTP POST JSON Object<\/h3>\n\n\n\n<p>Or if you prefer to make an HTTP POST request with a JSON object:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>POST \/update-sensor HTTP\/1.1\nHost: example.com\n{api_key: \"tPmAT5Ab3j7F9\", sensor_name: \"BME280\", temperature: 24.25; humidity: 49.54; pressure: 1005.14}\nContent-Type: application\/json<\/code><\/pre>\n\n\n\n<p>Use the next snippet:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>http.addHeader(\"Content-Type\", \"application\/json\");\n\nint httpResponseCode = http.POST(\"{\\\"api_key\\\":\\\"tPmAT5Ab3j7F9\\\",\\\"sensor\\\":\\\"BME280\\\",\\\"value1\\\":\\\"24.25\\\",\\\"value2\\\":\\\"49.54\\\",\\\"value3\\\":\\\"1005.14\\\"}\");<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">HTTP Plain Text<\/h3>\n\n\n\n<p>If you want to send plain text or a value, use the following:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>http.addHeader(\"Content-Type\", \"text\/plain\");\n\nint httpResponseCode = http.POST(\"Hello, World!\");<\/code><\/pre>\n\n\n\n<p><strong>Note: <\/strong> the Node-RED flow we&#8217;re using (web service) is not setup to receive plain text, but if the API that you plan to integrate only accepts plain text or a value, you can use the previous snippet. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">HTTP POST Demonstration<\/h3>\n\n\n\n<p>In the Node-RED debug window, you can view that your ESP is making an HTTP POST request every 5 seconds.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"439\" height=\"236\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/udpate-data-esp32-HTTP-POST-ESP8266-NodeMCU-Arduino-value.png?resize=439%2C236&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-95522\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/udpate-data-esp32-HTTP-POST-ESP8266-NodeMCU-Arduino-value.png?w=439&amp;quality=100&amp;strip=all&amp;ssl=1 439w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/udpate-data-esp32-HTTP-POST-ESP8266-NodeMCU-Arduino-value.png?resize=300%2C161&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 439px) 100vw, 439px\" \/><\/figure><\/div>\n\n\n<p>And in this example, those values are also sent to 3 Gauges and are displayed in Node-RED Dashboard:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;raspberry-pi-ip-address:1880\/ui<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/ESP32-ESP8266-HTTP-GET-POST-Demonstration.png?resize=518%2C806&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-95523\" width=\"518\" height=\"806\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/ESP32-ESP8266-HTTP-GET-POST-Demonstration.png?w=579&amp;quality=100&amp;strip=all&amp;ssl=1 579w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/ESP32-ESP8266-HTTP-GET-POST-Demonstration.png?resize=193%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 193w\" sizes=\"(max-width: 518px) 100vw, 518px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>In this tutorial you&#8217;ve learned how to integrate your ESP32 with online services using HTTP GET and HTTP POST requests.<\/p>\n\n\n\n<p>HTTP GET and HTTP POST are commonly used in most web services and APIs. These can be useful in your projects to: publish your sensor readings to a web service like IFTTT, ThingSpeak; to an ESP32 or Raspberry Pi web server or to your own server; to request data from the internet or from your database, and much more.<\/p>\n\n\n\n<p>If you&#8217;re using an ESP8266 board, read: <a href=\"https:\/\/randomnerdtutorials.com\/esp8266-nodemcu-http-get-post-arduino\/\">Guide for ESP8266 NodeMCU HTTP GET and HTTP Post Requests<\/a>.<\/p>\n\n\n\n<p><strong>You might also like reading:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong><a href=\"https:\/\/randomnerdtutorials.com\/learn-esp32-with-arduino-ide\/\">[Course] <\/a><\/strong><span><strong><a href=\"https:\/\/randomnerdtutorials.com\/learn-esp32-with-arduino-ide\/\">Learn ESP32 with Arduino IDE<\/a><\/strong><\/span><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-esp8266-send-email-notification\/\">ESP32\/ESP8266 Send Email Notification using PHP Script<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/visualize-esp32-esp8266-sensor-readings-from-anywhere\/\">Visualize Your Sensor Readings from Anywhere in the World (ESP32\/ESP8266 + MySQL + PHP) using Charts<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-relay-module-ac-web-server\/\">ESP32 Relay Module Web Server<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/micropython-programming-with-esp32-and-esp8266\/\">MicroPython Programming with ESP32 and ESP8266<\/a><\/li><\/ul>\n\n\n\n<p>I hope you liked this project. If you have any questions, post a comment below and we&#8217;ll try to get back to you.<\/p>\n\n\n\n<p class=\"rntbox rntclgray\">If you like ESP32, you might consider enrolling in our course &#8220;<a href=\"https:\/\/randomnerdtutorials.com\/learn-esp32-with-arduino-ide\/\">Learn ESP32 with Arduino IDE<\/a>&#8220;. You can also access our free <a href=\"https:\/\/randomnerdtutorials.com\/projects-esp32\/\">ESP32 resources here<\/a>. <\/p>\n\n\n\n<p>Thank you for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, you&#8217;ll learn how to make HTTP GET and HTTP POST requests with the ESP32 board with Arduino IDE. We&#8217;ll cover examples on how to get values, post &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"ESP32 HTTP GET and HTTP POST with Arduino IDE (JSON, URL Encoded, Text)\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/esp32-http-get-post-arduino\/#more-95443\" aria-label=\"Read more about ESP32 HTTP GET and HTTP POST with Arduino IDE (JSON, URL Encoded, Text)\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":95502,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[276,281,277,299,264],"tags":[],"class_list":["post-95443","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp32","category-esp32-project","category-esp32-arduino-ide","category-0-esp32","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/ESP32-HTTP-GET-HTTP-POST-with-Arduino-IDE-JSON-URL-Encoded-Text.jpg?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/95443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=95443"}],"version-history":[{"count":6,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/95443\/revisions"}],"predecessor-version":[{"id":120201,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/95443\/revisions\/120201"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/95502"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=95443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=95443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=95443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}