Connecting to an API using an ESP8266 (Or any Arduino)

Поделиться
HTML-код
  • Опубликовано: 2 авг 2024
  • In this video we take a look at connecting to an API with ESP8266 and some of the options that are available when doing so
    ---------------------------------
    Code:
    ---------------------------------
    Sample Request code: github.com/witnessmenow/ardui...
    ---------------------------------
    Links:
    ---------------------------------
    Hackaday.io API : dev.hackaday.io/
    Hackaday.io API Arduino library: github.com/witnessmenow/ardui...
    Postman: www.getpostman.com/
    ---------------------------------
    Github Sponsorship:
    ---------------------------------
    I have set up a Github Sponsorship page, it's similar style thing to patreon, but Github are offering to match all sponsorships for the first year! (you sponsor $2, I receive $4)
    github.com/sponsors/witnessme...
    Some people have said they would prefer a once off way of supporting the channel, here is a Paypal link if you would prefer that!
    www.paypal.me/bloughyt
    ---------------------------------
    My Tindie Store:
    ---------------------------------
    I've started to sell stuff on Tindie, check it out!
    www.tindie.com/stores/brianlo...
    ---------------------------------
    Other Platforms:
    ---------------------------------
    Twitter: @witnessmenow - / witnessmenow
    Instagram - / brian_lough
    Instructables: witnessmenow - www.instructables.com/member/...
    ---------------------------------
    Support the Channel:
    ---------------------------------
    If you would like to support the channel, here are some ways you can.
    1 - Like and comment on the videos - I really like hearing from you and apparently it helps!
    2 - Share my videos - If you know somewhere that might be interested in my channel, please share it!
    3 - Affiliate links - Where I get a small percentage of the purchase price but doesn't cost you anything extra.
    Amazon.co.uk: amzn.to/2g7mJIO
    Amazon.com : amzn.to/2ykDQ42
    Amazon.de: amzn.to/2WMq7vF
    Aliexpress: s.click.aliexpress.com/e/wdhojba
    LCSC (where I buy most of my parts for Tindie stuff): lcsc.com/?promote=ODM5ZTB5Nlk...
    4 - My Amazon "store" - Really it's just a collection of stuff I use that I think are useful
    www.amazon.co.uk/shop/brianlough
    5 - Check out my Tindie Store
    www.tindie.com/stores/brianlo...
    ---------------------------------
    My Tools & Kit*:
    ---------------------------------
    Ender 3 Pro 3d Printer - I got one of these recently and I love it!
    - UK : amzn.to/31bebXT
    - US : amzn.to/2IlSLid
    Ts-100 Soldering Iron - I have this a couple of years and I love it, I thinking about getting a second!
    - UK : amzn.to/2nlOF23
    - US : amzn.to/2jDcyxl
    Logitech C920 HD 1080p Pro webcam - I use one of these for my videos
    - UK: amzn.to/2pnxk9Z
    - US: amzn.to/2BsLMiF
    Blue Snowball USB Microphone
    - UK: amzn.to/2C0x4TH
    - US: amzn.to/2DEA85J
    Self Adjusting Wire Strippers
    - UK: amzn.to/2C0urkR
    - US: amzn.to/2BXQAh1
    *= Affiliate Links
  • НаукаНаука

Комментарии • 54

  • @BrianLough
    @BrianLough  4 года назад +24

    If you would like a part 2 please let me know, we can go through turning what we have into a library.
    FYI: Anything that wasn't me in my office was recorded about 6 months ago! The other thing that happened that put a spanner in the video works around that time is out second daughter was born around that time!

    • @mtayseer82
      @mtayseer82 4 года назад

      Yes, please

    • @gavinsmalley1513
      @gavinsmalley1513 4 года назад

      Definitely interested in Part 2. Especially using the new arduino json. I think that change affected a lot of us and I'd definitely be interested in learning how to use the new one.

    • @JohnnyAdz.
      @JohnnyAdz. 4 года назад

      Definitely and congrats

    • @lingsun5010
      @lingsun5010 4 года назад

      yes pls:)

    • @highroyds
      @highroyds 3 года назад

      This has been the best tutorial I’ve found with explaining the code and examples. I would love to see part 2.

  • @tylersundberg8249
    @tylersundberg8249 4 года назад +2

    This is a great tutorial Brian. I could've used this a couple months ago, but you're super helpful as always!

  • @philippeschjelderup9644
    @philippeschjelderup9644 4 года назад +1

    This is really useful Brian! Please create a part 2. :)

  • @ristomatti
    @ristomatti 4 года назад +1

    Thanks for immediately reacting to feedback! Code was now easy to follow also on a tablet screen. Using API's happens to be part of my daily work but added a like just because of the editing. :)

    • @BrianLough
      @BrianLough  4 года назад

      Thanks!
      I think two things contributed to this:
      1) I did make an effort to zoom in on the parts I was speaking about after feedback from the last video.
      2) the video was shot on my 1080p monitor when I had it, so even though I did scale the text of the Arduino IDE up in my last video, the resolution is much higher than by the time it makes it into the video it's too small. I will scale it up even more in future when using my higher res monitor!

    • @ristomatti
      @ristomatti 4 года назад

      @@BrianLough If the zooming in/out takes a lot of time, you could simply set a 1080p resolution for the screen captures and increase the font size. Scaling effects could be then only needed if wanting to highlight browsing menus/settings. Hope this helps!

  • @thijstig
    @thijstig 3 года назад

    Nice and pleasant video to watch. Thank you so much for sharing. Keep up the good work!

  • @Magic-Smoke
    @Magic-Smoke 4 года назад +1

    Cool beans Brian. I do think it might be worth doing Part II. The ArduinoJSON change from v5 to v6 was a big breaking change and a good example of v6 usage would be nice and would round off a useful topic

    • @BrianLough
      @BrianLough  4 года назад +1

      It was breaking change but what I had to do to upgrade actually wasn't that much! But seems like there is some interest in the library video!

  • @ChunkySteveo
    @ChunkySteveo 4 года назад

    Another great video Brian!

  • @TechnoWit3D
    @TechnoWit3D 3 года назад

    I would like to put the api key through wifi manager web page , do you know any tutorial for that one ?

  • @jamess1787
    @jamess1787 4 года назад +3

    Brian, I love your monotone Irish accent. It's amazeballs

    • @BrianLough
      @BrianLough  4 года назад +1

      I'm from the midlands in Ireland, which a particularly monotone twang to it :P

  • @Kopellis
    @Kopellis 3 года назад +1

    Can you do this with arduino uno? or do you need an arduino with ethernet connection?

  • @JulianBejarano
    @JulianBejarano 7 месяцев назад

    very useful, thanks a lot

  • @random1za
    @random1za 4 года назад

    Hey Brian cheers for the helpful video! Would it theoretically be possible use this API and Arduino library to actually interact with RUclips content? For example, leave a like on a certain video when the ESP8266 received an analogue input? Thanks!

  • @christophersfactory
    @christophersfactory Год назад

    Thanks for the tips! Now to figure out how to reduce memory usage!...

  • @ameyadalvi1493
    @ameyadalvi1493 4 года назад

    Great video👍

  • @shaflyhamzah3848
    @shaflyhamzah3848 3 года назад

    Thanks!

  • @ViciousOne
    @ViciousOne 4 года назад

    Thanks for this very clear tutorial. Now I did some of this stuff allready myself, but I ran into a problem.
    One api gives me a lot of data, so it is zipped. I can download the data unzipped, but than it will take a long time to get and parse the data. What I really want is to unzip the stuff, but there is hardly anything to find on the internet about deflate, unzip or miniz. Maybe a challenge there..?

  • @keithneal7927
    @keithneal7927 6 месяцев назад

    Hi Brian I know its several years since you did this video, but I've found it as i'm trying to build a display that uses an API for train departure info, using a ESP8266 to get the data. I've used your sketch which with several changes i manage to get an error "Unexpected Error HTTP1.1 400" so I presume it must be trying to connect to the API server. The API requires Basic authorisation which if i use in Postman returns the data i'm after. I looked at the Code snippet in Postman and my request looks the same. I 've got this far using the HTTP setting rather than the HTTPS settings. When I use the HTTPS settings I get a Failed to Connect error. I tried your method to get the Finger print but the API server doesn't give the same as I only have the choose of Pubic Key or Certificate neither which seem to make any difference to the Failed to connect error. As I'm new to this I am really struggling, I trawled the net, and tried out other sketch but your's has enable me to get further with the 400 error. I can send you my code if your where able to help. Thanks Keith

  • @malgamves
    @malgamves 4 года назад

    Hey, loved this! Could you do a video for how to setup the connections on the esp8266? I have a separate module

    • @BrianLough
      @BrianLough  4 года назад +1

      The wiring connections to get a esp8266 module up and running is it?
      I kind of cover it in this video:
      ruclips.net/video/37KlzYhJaQs/видео.html

  • @GreenBrainARC
    @GreenBrainARC 4 года назад +1

    Hi, cool videos. Could you do me a favor? I have problems with the Twitch Client Id. Can you make a video about it? That would be great

  • @niallpeel7832
    @niallpeel7832 8 месяцев назад

    Great video!!! I learned a lot on how to connect my NANO to the API i wanna use! I did have one hiccup though, I was having issues with the API responding to HTTP/1.0 or HTTP/1.1 and on line 123 where you do the comparison (ESP8266 HTTP_GET.ino on your github) you use || for OR but i think you want an AND compassion because if it returns one or the other it should continue with the program. I see that the video is different so i just wanted to leave this here for anyone that is struggling while using the git hub code. Again great video!!!!

  • @gilagame5898
    @gilagame5898 4 года назад

    Hello sir, may you want to help me. I have a problem with examples FlashLed on Universal telegram bot, esp8266 still connected with wifi. But when i try talking the bot telegram, i didn't get any reply. How to fix this?
    I am using arduinojson 5.13.3, universal telegram 1.1.0, esp8266 board 2.4.2 and Using Wemos D1 R1. Thanks a lot for attention 😊

    • @BrianLough
      @BrianLough  4 года назад +1

      You probably need to add client.setInsecure() to your setup

    • @gilagame5898
      @gilagame5898 4 года назад

      @@BrianLoughsorry sir, i am new studying about iot project. Where can i put it?
      Thanks you

    • @gilagame5898
      @gilagame5898 4 года назад

      @@BrianLoughi trying put client.setInsecure under wificlientsecure client;
      Then verifying compile error.
      I am using universal telegram bot 1.1.0

    • @gilagame5898
      @gilagame5898 4 года назад

      @@BrianLough i send DM on your Instagram sir screenshot code programming

  • @sistemamarco
    @sistemamarco 7 месяцев назад

    This is a Excellent tutorial.
    What about a POST request?
    Eg. If we want to send some data to an API

    • @BrianLough
      @BrianLough  7 месяцев назад

      It's pretty similar, I have some examples in my libraries
      github.com/witnessmenow/spotify-api-arduino/blob/main/src/SpotifyArduino.cpp#L105 for example

  • @danilokrausz9103
    @danilokrausz9103 4 года назад

    I've trying to use ChannelStatistics but stops in this part.
    WiFi connected
    IP address:
    192.168.0.173
    Any Help?
    github.com/witnessmenow/arduino-youtube-api

    • @idontknowwhatimdoing3526
      @idontknowwhatimdoing3526 4 года назад

      had the same issue - try inserting the following line of code into the your void(setup){} (as suggested by Brian in one of the "issues" thread on his github):
      *client.setInsecure();*
      I did that and it fixed it like magic!

  • @brianb5178
    @brianb5178 4 года назад

    I just let node red/mqtt handle everything now so much easier.

    • @BrianLough
      @BrianLough  4 года назад

      I think that's a good solution too, if you have node red set up already it's certainly easier. I do like things to be stand alone though if it makes sense

    • @ristomatti
      @ristomatti 4 года назад

      This is much cleaner approach but there are a lot of situation you might want to still do this. For example if you'd build something to a friend/relative/workplace in which case you would likely want to avoid the extra setup, maintenance and/or cost.

  • @georgealanminor
    @georgealanminor 4 года назад

    Brian, thanks for putting this video up. Been following you via Reddit for a while now.
    Can you help me figure out what I'm doing wrong in the sample sketch that I cannot get the following API to work correctly:
    www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=MSFT&interval=5min&apikey=demo
    I've tried with and without HTTPS, port 443 and 80, and a couple other changes but to no avail. It would be very helpful if you could shed some insight for me. Thanks man!

  • @newburypi
    @newburypi 4 года назад

    Dude. Hair cut :)

  • @tecnovlogger
    @tecnovlogger 4 года назад

    Sorry, I like a lot you’re videos, but why you use that microphone??? It’s to big

    • @BrianLough
      @BrianLough  4 года назад +1

      I don't normally show my face all that much so it was never a problem before 😅

    • @newburypi
      @newburypi 4 года назад

      @@BrianLough

    • @tecnovlogger
      @tecnovlogger 4 года назад

      @@BrianLough lol no problem