How To Interact With A Simple API in WordPress - Advanced WordPress Tutorial

Поділитися
Вставка
  • Опубліковано 27 тра 2019
  • In this tutorial, we go over how to scrape a remote data source (API) and store that data in a Custom Post Type that has a set of Advanced Custom Fields. This is a real-world project that I used to create a timed-scrape for a side project.
    Sign up for the newsletter to notified about the free 2020 WordPress Development Course: wpcasts.tv
    Get WordPress Hosting:
    wpcasts.tv/go/kinsta
    *Don't forget to subscribe!*
    **Make sure to visit the live project: brewla.la/ **
    Correction at 33:51 - "weekly" is a custom interval. You have to create that on your own with something like this: developer.wordpress.org/plugi...
    ** FULL CODE REPOSITORY **
    github.com/alexander-young/br...
    *SOCIAL*
    Twitter: / _wpcasts_tv_
    Instagram: / the_alex_young
    #WordPress #API #RealWorldProject

КОМЕНТАРІ • 192

  • @WPCasts
    @WPCasts  4 роки тому +7

    Sign up for the newsletter to notified about the free 2020 WordPress Development Course: wpcasts.tv

    • @timucin4220
      @timucin4220 2 роки тому

      i cannot reach wpcasts website

    • @abdul_qadir7780
      @abdul_qadir7780 2 роки тому

      Link is an empty wordpress website. By the way thank you for great video.

  • @mountainman9570
    @mountainman9570 4 роки тому +112

    I really enjoyed this! Thanks for speaking slowly and clearly. I am 75 and trying to learn a bit more about Wordpress. I support about 6 sites and would like to learn how to do some customization work.

    • @sameermishra3598
      @sameermishra3598 2 роки тому +11

      Wow ! Keep inspiring us young ones sir!

    • @killerdude909
      @killerdude909 2 роки тому +4

      how are you doing today sir?

    • @stephenm3874
      @stephenm3874 2 роки тому +4

      Sweet! I'm 67 and started programming when I was 47 and made a nice living from it. You rock!

    • @pmx5684
      @pmx5684 2 роки тому

      thats awesome!!!

    • @abdul_qadir7780
      @abdul_qadir7780 2 роки тому +1

      Hey Mountain, I really inspire me. Best of luck

  • @stillready6405
    @stillready6405 2 роки тому +7

    Wow. This tutorial is really good and you made it very easy to follow without skipping important parts and giving a clear path to follow. I'm glad I found the video!

  • @chrisklightandsound2801
    @chrisklightandsound2801 4 роки тому +19

    Just to give some feedback, this tutorial really helped me to get an api integration running on my company. As someone with a very limited background in coding, this was a perfect starting place. Thanks

  • @priestofpsi
    @priestofpsi 3 роки тому +6

    As a programmer who has never touched wordpress, this was brilliant. Learnt far more from this (i actually watched this) and learnt the exact thing I was wanting to.
    Excellent excellent excellent video!

  • @imarkdesigns
    @imarkdesigns 4 роки тому +17

    THIS video helped me saving my ass to my project. I really appreciate your effort on doing this video. Thanks Alex!

  • @onemoreprince
    @onemoreprince 3 роки тому +1

    Really very helpful. Content on a topic like this is scare & due to such reasons it is very tough for a non-coder with good experience of working with themes & plugin (even some advance plugins like toolset, pods) can do pretty easy things like using API.

  • @kerimtim
    @kerimtim 3 роки тому +2

    Your videos are just unbelievably simple professional and amazing

  • @JassarDev
    @JassarDev 4 роки тому +4

    Not specifically looking for this function but this tutorial is amazing!

  • @ashkanahmadi
    @ashkanahmadi 2 роки тому +1

    Excellent. I got a bit confused by the end but overall, thank you for showing everything from scratch instead of keep saying "i already wrote half of the code offsceen".

  • @JerryFerguson
    @JerryFerguson 7 місяців тому

    Hey Alex! Amazingly straightforward video and exactly what I needed for the project I'm working on! Right on!

  • @kerimtim
    @kerimtim Рік тому

    Wow. This is a great video tutorial, a starting point for integrating any possible API. Thank you!

  • @kennyirvine8786
    @kennyirvine8786 Рік тому

    Amazing tutorial! It helped me out soo much! Something I think that is missing is removing a brewery from WP if it no longer exists in the API response. Easy enough to figure out though.

  • @ChadAmI80
    @ChadAmI80 3 роки тому

    Great overview of some new to me wp functions. I learned several things from your video. Thanks!

  • @guizuk3
    @guizuk3 4 роки тому +1

    Incredible, man! Good job you did here, congrats!

  • @mayanikolova8353
    @mayanikolova8353 3 роки тому +1

    Incredibly useful and well delivered. Thank you!

  • @martinkaspar5095
    @martinkaspar5095 Рік тому

    Thank you so much! As useful as usual! Keep inspiring us. Thanks a million. I've been waiting for this forever.
    I cannot thank you enough 👍 - plz keep up the awesome work i would love to see more of your great vids - ...

  • @fekedewhailemariam5979
    @fekedewhailemariam5979 3 роки тому

    I really appreciate your effort on doing this video. Thanks!

  • @RobertoTenil
    @RobertoTenil 2 роки тому +7

    Correct me if I'm wrong, but when you put >= on line 73 (31:40), the = takes away the whole purpose of the function, which would be to update only the newest ones (>). Those with the same timestamp (=) shouldn't be updated.
    The tutorial is excellent, and it helped me a lot. Thanks. 👍

  • @felixlozada5260
    @felixlozada5260 2 роки тому

    Increible tutorial, ya con esto lo combinas con un oage builder y haces magia, de verdad muchas gracias

  • @digwillhachi
    @digwillhachi 2 роки тому

    this is amazing. really well explained and informative. thank you.

  • @hkyoyo
    @hkyoyo 3 роки тому

    I love this cast. Great work mate!

  • @pierrot8762
    @pierrot8762 Рік тому

    Hi
    I'm japanese.
    your video is very great‼
    Thanks

  • @j8ahmed
    @j8ahmed 8 місяців тому

    This was a phenomenal explanation. Thank you!

  • @technoar8161
    @technoar8161 Рік тому

    Thanks a lot!!!, this video really help me.

  • @ahmedmusawir
    @ahmedmusawir 4 роки тому +6

    Amazing!! Can you plz give us a how-to series on building a whole CRUD app using WP Graph QL and React? Pleeeease?

  • @VinceAlvare
    @VinceAlvare 4 роки тому +2

    Very nice tutorial! I'm hoping this helps me work out how to scrape the ebay trading API and import to WooCommerce product data on a daily cycle. I could definitely see myself using this with ACF in the future as well. I'm not a php pro, and my API experience is limited, so this is extremely helpful in just wrapping my head around things. Keep the vids comin!

    • @felixlozada5260
      @felixlozada5260 Рік тому

      how did you upload variable products in woocommerce?

  • @theman7050
    @theman7050 2 роки тому +1

    This is a legendary WP video!!

  • @alihussain1974
    @alihussain1974 2 роки тому

    Please create more videos on API integration in wordpress. And thank you so much for such a Great video sir 😊❤️

  • @fissunix
    @fissunix 5 років тому +5

    Awesome tutorial !

  • @soultouchingsongs
    @soultouchingsongs 4 роки тому +1

    Awesome 👏. Thanks a ton for this valuable content. 🙏

  • @kaungko7393
    @kaungko7393 2 роки тому

    Very clear and well explained. Thank alot.

  • @leokattah
    @leokattah 2 роки тому

    Congrats for the tutorial. It really helped me.

  • @biotropicsmensformula4811
    @biotropicsmensformula4811 4 роки тому

    Great. Really new thing for me. It's heavy and I like it

  • @jakeparrotta7372
    @jakeparrotta7372 3 роки тому +1

    Wow I was able to do this line by line, and then repurpose it for another API. Thanks so much WPCasts, let me know if I can buy you a coffee (virtually) Cheers!!!

    • @jakeparrotta7372
      @jakeparrotta7372 3 роки тому

      Nevermind lol found your Patreon!! 👍🏼

    • @jakeparrotta7372
      @jakeparrotta7372 2 роки тому

      @wpcasts If you have a moment to reply I am really stuck! I am finding that my it takes a long time for my admin-ajax call to load, and some of the posts are duplicates. Is this because I am overloading the script with so many db queries and update_fields? I am mapping over 270 fields for many post objects at once. What would be a better action hook? maybe init? or some wp api one? Please help

  • @kmmarch60
    @kmmarch60 2 роки тому

    Great tutorial! I'm trying to figure out how to import products into WooCommerce via an API. This has helped me immensely.

  • @rickyrozario1577
    @rickyrozario1577 2 роки тому +4

    Hi, first of all great video! Learned a lot from it. I have one question, What if a brewery is deleted from the API? How will you find the obsolete brewary in your WordPress database and delete it there as well? What checks can we run to achieve this?

  • @AiBusinessConsulting
    @AiBusinessConsulting 5 років тому +2

    Very nice tutorial. What editor do you use? Also could you have got this brewery info from the Google API? Also you should consider integrating Google reviews and when you got time change it so when some wants directions they stay on your site. I am really impressed with what you have done here and how simple your explanation was.

  • @kokapeli
    @kokapeli 2 роки тому

    Amazing video! Thank you!

  • @Itsrichayo
    @Itsrichayo 4 роки тому

    This is a great job. I love the explainers though I had a tough time following you. This means I have a lot to learn. Do you collaborate on projects?

  • @propertunity
    @propertunity 2 роки тому

    Hey Alex great video! Really glad I found you! Did you happen to do a video for when you created the interactive map for Brewlala ?

  • @jameschoyens23
    @jameschoyens23 4 роки тому +2

    I finished an Ad as a thank you.

  • @nagg9007
    @nagg9007 4 роки тому +1

    Really helpful. Looking for this kind of stuff. Can we display this on seperate page? Let's say Im integrating with different API, so for each API I need to create a page then show results there.

  • @pifonsi
    @pifonsi 4 роки тому

    Wow, great video, I love it!

  • @juanitacami9023
    @juanitacami9023 4 роки тому

    Excellent tutorial

  • @manassane4681
    @manassane4681 3 роки тому

    Great video. To the point. Can you help me in understanding which theme is used here?

  • @gobodeath1214
    @gobodeath1214 4 роки тому

    I've seen that when sending the $url parameter in the wp_remote_get the function esc_url_raw() is used, do you know why? I see you don't use it, but wanna know whyt

  • @user-ub7xo3qz2b
    @user-ub7xo3qz2b 5 років тому +4

    Thanks for another amazing tutorial. I really hope you set up a patreon or do a udemy course at some point, it would be great to support such useful content!

  • @serifahmet
    @serifahmet 2 роки тому

    Thank you for this very useful tutorial. However in my case I was not able to write the fields created by ACF. I was able to see the post titles in the custom post type I created however not necessarily the contents of the ACF fields I created. What in your opinion is the problem? Thank you...

  • @gillessabathe6086
    @gillessabathe6086 3 роки тому

    Thanks for this video !

  • @berenjor
    @berenjor 3 роки тому +2

    Is it possible that the key for each field in custom field is now only available with the pro version of Advanced Custom Fields?

  • @GregRobinsonHD
    @GregRobinsonHD 3 роки тому

    Great tutorial, thanks! Just curious: which JSON formatter/viewer are you using within your web browser to make the text more readable? (see 0:47s)

  • @phoneyiam123
    @phoneyiam123 2 роки тому +1

    Any idea as to why there would be two entries created instead of just one? They both have the same permalink but show up twice in the Breweries CPT.

  • @joyprince6301
    @joyprince6301 Рік тому

    Its really awesome video,
    do you have any video based on using the api data from custom fields in the Website?

  • @sufiansuhail9243
    @sufiansuhail9243 3 роки тому

    Awesome, thank you very much

  • @paul7973
    @paul7973 4 роки тому +19

    One of the best tutorials I've seen on this subject by far... but I died when you decided not to show the front-end. Do you think you'll ever take what this tutorial delivered and extend it a little further to show how you created what you did with the map and search etc?

  • @janpanev2820
    @janpanev2820 4 роки тому

    Thanks for that great video! Which program do you use for coding? I like the Wordpress tooltips it's displaying.

  • @andreas-stricker
    @andreas-stricker 3 роки тому +1

    really nice explained! But what if a brewery gets deleted in the api? The brewery would still exist as a custom post type, right?

  • @daviduarte22
    @daviduarte22 2 роки тому

    thank you very much for sharing the content, by any chance if I want to save the information in taxonomies, could I save it?

  • @Arnaudherr
    @Arnaudherr 3 місяці тому

    Hey thanks for this very helpful tuto 😇 How can we deal with multilingual blog using polylang ?

  • @justinbrown8214
    @justinbrown8214 2 місяці тому

    Hi @WPCasts,
    Love your video. I'm making progress but my api is a bit more complicated as it's json array has multiple dimensions to it, I can successfully parse info from the first dimension, but none of the subsequent dimensions.
    Do you have any idea why this might be?
    Thanks a bunch!

  • @danielrozin9843
    @danielrozin9843 Рік тому

    I have 2 wordpress websites that I need to sync the ACF dynamic field between them.
    When some list is uploaded at the first website, I want that the same list will be upload on the 2nd website, automatically.
    What is the best way to make it happen?

  • @vehbirestelica2243
    @vehbirestelica2243 2 роки тому

    Hi, I really enjoyed this video!! I have a question regarding the json showing in the wp. I did all the steps u showed, but still couldnt get any data! Ps the API is showing as XML(not as JSON), could that be the problem? Thanks in advance :)

  • @justinbrown8214
    @justinbrown8214 2 місяці тому

    Is there a reason to do this with recursion instead of a for loop? It seems easier to me for my cases.
    Thanks!

  •  3 роки тому

    Dude! you cover every theme I am looking for! I just seen the first minute of this video and its just what I need. Thank you! Where is your patreon page!

    • @WPCasts
      @WPCasts  3 роки тому +1

      I’m so glad! It’s www.patreon.com/wpcasts we also have a few exclusive videos over there :)

    •  3 роки тому

      Found it!

  • @felixlvh
    @felixlvh 4 роки тому +1

    Will you have a complete course for integrating third party api to wordpress?

  • @tschroeder131313
    @tschroeder131313 Рік тому

    Do we have the tutorial for building the map section? I have this part done all ready :)

  • @justinbrown8214
    @justinbrown8214 2 місяці тому

    What's the best way to do this if the API I'm using has multiple dimensions to the data? Is there a different custom field data type I can use?
    Thanks for your video!

  • @johngiftakis9878
    @johngiftakis9878 3 роки тому

    How we could make a Webhook so for example when a Plugin is installed to send a REST API call to a 3rd party backend and not using cron job?

  • @DavidMSSmith
    @DavidMSSmith 4 роки тому

    Is there a followup video where you show how you created the front end? Otherwise, pretty cool!

  • @mercadoclic7780
    @mercadoclic7780 2 роки тому

    Wow! its very usefull. I have one question, What theme do you used in this example?

  • @anigarzat7
    @anigarzat7 4 місяці тому

    Great!! I am looking for a wordpress plugin or script that works with ticketmaster API to import the events or concerts from ticket master into my worpdress pages or posts. Can you help me? thanks!!

  • @user-tx6mp7on1t
    @user-tx6mp7on1t 10 місяців тому

    very nice !!!!! question .... how did you do the map thing

  • @denisecknauer4627
    @denisecknauer4627 3 роки тому

    Creating of such Custom Post Type will allow anyone to update values through REST API by checking wp-json options?

  • @felixlozada5260
    @felixlozada5260 Рік тому

    Hello, how would be the process to insert url of external images to an acf pro gallery?

  • @eugeneloggenberg1885
    @eugeneloggenberg1885 3 роки тому

    How would you go about adding images and image galleries to the ACF from the API information? Is there any way to contact you to get a quote on such a project?

  • @alcantaraallan
    @alcantaraallan Рік тому

    Hello Thank you for this, i subscribed because of this. question do you have something that interacts with the external API like CRUD? i think this included a authentication if im right. thank you again.

  • @patrick8105
    @patrick8105 3 роки тому

    Could you please make a video on how to import/use the code. Thanks

  • @davidjordan9365
    @davidjordan9365 2 роки тому

    Hi, this tutorial is very helpful. I do have a question about being able to replicate this using the Divi Theme. Thanks!

  • @pasizdobrekuce
    @pasizdobrekuce 4 роки тому

    I want to buy you a beer. This is actually one of rare WP "real world case" tuts. Include "buy me a beer" link in your posts.

    • @WPCasts
      @WPCasts  4 роки тому +1

      I'm really glad you found it helpful! The only thing I have currently is a Patreon: www.patreon.com/wpcasts

  • @meeramadhu4392
    @meeramadhu4392 4 роки тому +1

    hai,,,, how to get the product inforamtion from one ecommerce website to another by using api can plz suggest a youtube video realated to that.

  • @JingMingLi
    @JingMingLi 3 роки тому

    What if we are using a wordpress theme with a custom post type that does not show Field_keys?

  • @colandru
    @colandru 3 роки тому

    If I would decide, could I achieve this with Python instead of PHP? thanks in advance

  • @mindwasher1813
    @mindwasher1813 3 роки тому

    this is exactly what i needed

  • @sahibzarkhan936
    @sahibzarkhan936 2 роки тому

    how can we register a hook to external api. lets say I have api, it spits out changes based on some events. I want to hook/listen to those changes in wordpress. (API hooks)

  • @davidebordin4499
    @davidebordin4499 2 роки тому

    Thank you. I have an api in which I’m registered with id and password, why wp_remote_get return me an unauthorized response ?

  • @autotunekilledthevideostar639
    @autotunekilledthevideostar639 3 роки тому

    Can I integrate API from Ebay and Discogs into a Wordpress website I have built ?

  • @ivanmitic52
    @ivanmitic52 2 роки тому

    Hi , i have a question about this part 'if( $brewery->updated_at >= $exisiting_brewerey_timestamp )' , why you checking '>=' , then condition will always be true , not only if job 'updated on' was bigger , also you are checking if post exists by 'slug' , if in the api title is changed , that will be considered as a new post , which will add post twice

  • @Johnathonaaron
    @Johnathonaaron 2 роки тому

    Is this storing the breweries data into the wp MySql server? Or is it calling it every time the costomer comes. If it does call it once and store it then how do you handle updates?

  • @malves82
    @malves82 Рік тому

    Is there anyway to use this method to scrap my offline website that is saved on my laptop?

  •  3 роки тому

    I am having troubles following the example with arrow selectors as an example
    update_field( $key, $brewery->$name, $inserted_brewery ); doesnt work for me
    update_field( $key, $brewery[$name], $inserted_brewery ); does work fine
    I dont know how to find the difference, is an array or object notation issue or neigher of them :( ?

  • @wawayplays
    @wawayplays 2 роки тому

    where do you save the edited code in the wordpress?

  • @afflictionmarketing5303
    @afflictionmarketing5303 3 роки тому

    Can you please make a tutorial on create a shortcode that print two pages output with end points.
    For example : in woocommerce my-account short code is printing 6 pages by just one shortcode.
    Thank you in advance.

  • @redshoe02
    @redshoe02 2 роки тому

    Can we create the CPT with a plugin instead of coding?

  • @platformfamily8743
    @platformfamily8743 3 роки тому

    hello when i try to call admin url it gives me result of only one page but when i used it to fill the report.txt it goes through every page ..

  • @danielf535
    @danielf535 4 роки тому

    This repository has been archived by the owner. It is now read-only.
    What to use instead?

  • @johnballo2402
    @johnballo2402 4 роки тому +2

    Do Bank API also for a gateway payment. Thanks

  • @JingMingLi
    @JingMingLi 3 роки тому

    What is the tool that he is using to code this? I cant find the report.txt in wordpress

  • @alimosbah
    @alimosbah Рік тому

    Is there a way to protect a custom Rest API especially when POST Request

  • @infolovers1621
    @infolovers1621 3 роки тому

    I run this in admin panel: admin-ajax.php?action=get_breweries_from_api but my report.txt file is not created please help, then I created manually the report.txt file and it is not showing any content in it, sorry I am new in wordpress api learning. Thanks