# Library/sample code for REST call?

**URL:** <https://forum.arduino.cc/t/library-sample-code-for-rest-call/1280866>\
**Category:** UNO WiFi Rev2\
**Created:** [July 12, 2024, 9:15am UTC](https://forum.arduino.cc/t/library-sample-code-for-rest-call/1280866 "2024-07-12T09:15:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cruegger123](https://avatars.discourse-cdn.com/v4/letter/c/a9a28c/32.png) [@cruegger123](https://forum.arduino.cc/u/cruegger123)\
**Post date:** [July 12, 2024, 9:15am UTC](https://forum.arduino.cc/t/library-sample-code-for-rest-call/1280866/1 "2024-07-12T09:15:13Z")

</div>

Hi folks,  
I want to make a simple REST call from an Arduino Wifi Rev2 to my own REST server (not the cloud). I'm having some difficulty finding the right library to use and a simple example showing how to code a GET or POST call. I need to have the ability to specify server, port, and path.  
Can someone recommend:  
Library to use  
Sample code performing a GET or POST  
Thanks!

---

<div class="post-metadata">

**Author:** ![gilshultz](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gilshultz](https://forum.arduino.cc/u/gilshultz)\
**Post date:** [July 12, 2024, 3:47pm UTC](https://forum.arduino.cc/t/library-sample-code-for-rest-call/1280866/2 "2024-07-12T15:47:58Z")

</div>

What about the external hardware will it need a reset as well?

---

<div class="post-metadata">

**Author:** ![cruegger123](https://avatars.discourse-cdn.com/v4/letter/c/a9a28c/32.png) [@cruegger123](https://forum.arduino.cc/u/cruegger123)\
**Post date:** [July 12, 2024, 4:08pm UTC](https://forum.arduino.cc/t/library-sample-code-for-rest-call/1280866/3 "2024-07-12T16:08:03Z")

</div>

No external hardware needed.  
I want to be able to make repeating calls at defined intervals.  
Use case is uploading sensor data (e.g. Temperature/humidity) to a server to collect data. Can also use MQTT, but I wanted to see if there is a REST solution also.

---

<div class="post-metadata">

**Author:** ![cruegger123](https://avatars.discourse-cdn.com/v4/letter/c/a9a28c/32.png) [@cruegger123](https://forum.arduino.cc/u/cruegger123)\
**Post date:** [July 12, 2024, 9:04pm UTC](https://forum.arduino.cc/t/library-sample-code-for-rest-call/1280866/4 "2024-07-12T21:04:34Z")

</div>

Hi folks,  
I want to make a simple REST call from an Arduino Wifi Rev2 to my own REST server (not the cloud).

I'm having some difficulty finding the right library to use and a simple example showing how to code a GET or POST call. I need to have the ability to specify server, port, and path.  
Can someone recommend:  
Best Library to use  
Sample code performing a simple GET or POST to a REST server.  
Thanks!

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [July 12, 2024, 9:14pm UTC](https://forum.arduino.cc/t/library-sample-code-for-rest-call/1280866/5 "2024-07-12T21:14:14Z")

</div>

Your two or more topics on the same or similar subject have been merged.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

> [@How to get the best out of this forum](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966):
>
> See also [FAQ - Arduino Forum](https://forum.arduino.cc/faq) for general rules on forum behavior and etiquette. Hello, Welcome to the Arduino Forum. This guide explains how to get the best out of this forum. Please read and follow the instructions below. Being new here you might think this is having rules for the sake of rules, but that is not the case. If you don’t follow the guidelines all that happens is there is a long exchange of posts while we try to get you to tell us what we need in order to help you, which is frus…

It will help you get the best out of the forum in the future.

Thank you.

---

<div class="post-metadata">

**Author:** ![kenb4](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kenb4](https://forum.arduino.cc/u/kenb4)\
**Post date:** [July 15, 2024, 7:59pm UTC](https://forum.arduino.cc/t/library-sample-code-for-rest-call/1280866/6 "2024-07-15T19:59:06Z")

</div>

Did you try WiFiNINA? You end up manually "performing HTTP" as shown in the [WiFiWebClient example](https://github.com/arduino-libraries/WiFiNINA/blob/1.8.14/examples/WiFiWebClient/WiFiWebClient.ino#L80)

```cpp
    client.println("GET /json HTTP/1.1");
    client.println("Host: httpbin.org");
    client.println("Connection: close");
    client.println();

```

To process the JSON response (and to create JSON request bodies), use ArduinoJson. For a memory-constrained board like yours, you may stick to version 6. Use the [Assistant](https://arduinojson.org/v6/assistant/#/step1). You should be able to use the WiFi `client` as a stream. Note the link there if [using streams is too slow](https://arduinojson.org/v6/how-to/improve-speed/).

---

<div class="post-metadata">

**Author:** ![IoT\_hobbyist](https://avatars.discourse-cdn.com/v4/letter/i/e5b9ba/32.png) [@IoT\_hobbyist](https://forum.arduino.cc/u/IoT_hobbyist)\
**Post date:** [July 16, 2024, 4:24am UTC](https://forum.arduino.cc/t/library-sample-code-for-rest-call/1280866/7 "2024-07-16T04:24:57Z")

</div>

You can refer to this [Arduino making HTTP request](https://arduinogetstarted.com/tutorials/arduino-http-request) tutorial

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [January 12, 2025, 4:25am UTC](https://forum.arduino.cc/t/library-sample-code-for-rest-call/1280866/8 "2025-01-12T04:25:28Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
